diff options
author | Laurent Balland-Poirier <laurent.balland-poirier@laposte.net> | 2017-03-17 19:44:10 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-04-10 15:50:15 +0200 |
commit | bac6141665049e53c01715a88d46ca04d678ddf0 (patch) | |
tree | fde5cf494506848b4e3596e0232fb1fc5ff4416c /svl | |
parent | 55e7f73640d754bf0004a0d8a989e0a20de00351 (diff) |
tdf#106190 Tests of fraction formats
Improve error message if test fails
Add more formats to test
Need https://gerrit.libreoffice.org/35320/
Change-Id: I89f5071e12ff87cdf1c03912922918390531e972
Reviewed-on: https://gerrit.libreoffice.org/35377
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/qa/unit/svl.cxx | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index 8ac1dd722acc..99a1626f37cd 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -399,7 +399,16 @@ void Test::checkPreviewString(SvNumberFormatter& aFormatter, Color* pColor = nullptr; Color** ppColor = &pColor; if (!aFormatter.GetPreviewString(sCode, fPreviewNumber, sStr, ppColor, eLang)) - CPPUNIT_FAIL("GetPreviewString() failed"); + { + rtl::OString aMessage = "GetPreviewString( \""; + aMessage += rtl::OUStringToOString( sCode, RTL_TEXTENCODING_ASCII_US ); + aMessage += "\", "; + aMessage += rtl::OString::number( fPreviewNumber ); + aMessage += ", sStr, ppColor, "; + aMessage += rtl::OString::number( eLang ); + aMessage += " ) failed"; + CPPUNIT_FAIL( aMessage.getStr() ); + } CPPUNIT_ASSERT_EQUAL(sExpected, sStr); } @@ -1204,10 +1213,39 @@ void Test::testUserDefinedNumberFormats() sExpected = "before 1.2inside3E+0middle4 after"; checkPreviewString(aFormatter, sCode, 12345.667, eLang, sExpected); } + { // tdf#106190: text after fraction bar + sCode = "?/ ?"; + sExpected = "11/ 9"; + checkPreviewString(aFormatter, sCode, 1.2345667, eLang, sExpected); + sCode = "?/ 12"; + sExpected = "15/ 12"; + checkPreviewString(aFormatter, sCode, 1.2345667, eLang, sExpected); + sCode = "# ?/\" divisor \"?"; + sExpected = "1 2/ divisor 9"; + checkPreviewString(aFormatter, sCode, 1.2345667, eLang, sExpected); + sCode = "# ?/\"divided by \"?"; + sExpected = "1 2/divided by 9"; + checkPreviewString(aFormatter, sCode, 1.2345667, eLang, sExpected); + sCode = "?/\" \"12"; + sExpected = "15/ 12"; + checkPreviewString(aFormatter, sCode, 1.2345667, eLang, sExpected); + sCode = "?/\\ 12"; + sExpected = "15/ 12"; + checkPreviewString(aFormatter, sCode, 1.2345667, eLang, sExpected); + sCode = "# ?/ ???"; + sExpected = "3 1/ 2 "; + checkPreviewString(aFormatter, sCode, 3.5, eLang, sExpected); + } { // Display 1.96 as 2 and not 1 1/1 sCode = "# ?/?"; sExpected = "2 "; checkPreviewString(aFormatter, sCode, 1.96, eLang, sExpected); + sCode = "# ?/ ?"; + sExpected = "2 "; + checkPreviewString(aFormatter, sCode, 1.96, eLang, sExpected); + sCode = "# #/#"; + sExpected = "2"; + checkPreviewString(aFormatter, sCode, 1.96, eLang, sExpected); } { // tdf#79399 tdf#101462 Native Number Formats sCode = "[NatNum5][$-0404]General\\ "; |