[Libreoffice-commits] core.git: 2 commits - svl/qa svl/source
Eike Rathke
erack at redhat.com
Tue Oct 17 10:35:38 UTC 2017
svl/qa/unit/svl.cxx | 19 +++++++++++++++++++
svl/source/numbers/zforscan.cxx | 8 +++-----
2 files changed, 22 insertions(+), 5 deletions(-)
New commits:
commit d728492f4aa195fd4aec3ddb116879de76a95c6d
Author: Eike Rathke <erack at redhat.com>
Date: Tue Oct 17 12:34:35 2017 +0200
Add to nPos once instead of in each iteration
Change-Id: I9ab9d5be1edead3a83375d87910bc9128c894b85
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 5855f8928220..79212d271461 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -2411,19 +2411,18 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
bDecSep = true;
nTypeArray[i] = NF_SYMBOLTYPE_DIGIT;
OUString& rStr = sStrArray[i];
- nPos = nPos + sStrArray[i].getLength();
nCounter++;
i++;
while (i < nStringsCnt &&
sStrArray[i][0] == '0')
{
rStr += sStrArray[i];
- nPos = nPos + sStrArray[i].getLength();
nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
nResultStringsCnt--;
nCounter++;
i++;
}
+ nPos += rStr.getLength();
}
else
{
@@ -2561,19 +2560,18 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& rString )
bDecSep = true;
nTypeArray[i] = NF_SYMBOLTYPE_DIGIT;
OUString& rStr = sStrArray[i];
- nPos = nPos + sStrArray[i].getLength();
- i++;
nCounter++;
+ i++;
while (i < nStringsCnt &&
sStrArray[i][0] == '0')
{
rStr += sStrArray[i];
- nPos = nPos + sStrArray[i].getLength();
nTypeArray[i] = NF_SYMBOLTYPE_EMPTY;
nResultStringsCnt--;
nCounter++;
i++;
}
+ nPos += rStr.getLength();
}
else
{
commit d1538ef63863f7a016bd2c3752ccdd9819e41781
Author: Eike Rathke <erack at redhat.com>
Date: Tue Oct 17 12:32:09 2017 +0200
More tests for time and date+time fractions of seconds, tdf#112933 related
Covering the loop and non-loop states in
ImpSvNumberformatScan::FinalScan()
Change-Id: I4a8da617a2a61ad12a99462bfe4014aaa5a75c1b
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index 43824e4d8c71..a8ebfbc281aa 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -1311,6 +1311,25 @@ void Test::testUserDefinedNumberFormats()
sCode = "MM:SS.0";
sExpected = "23:53.6";
checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
+ // Two decimals.
+ sCode = "MM:SS.00";
+ sExpected = "23:53.61";
+ checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
+ // Three decimals.
+ sCode = "MM:SS.000";
+ sExpected = "23:53.605";
+ checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
+
+ // Same with date+time.
+ sCode = "YYYY-MM-DD MM:SS.0";
+ sExpected = "1900-01-02 23:53.6";
+ checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
+ sCode = "YYYY-MM-DD MM:SS.00";
+ sExpected = "1900-01-02 23:53.61";
+ checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
+ sCode = "YYYY-MM-DD MM:SS.000";
+ sExpected = "1900-01-02 23:53.605";
+ checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
}
}
More information about the Libreoffice-commits
mailing list