svl/qa/unit/svl.cxx | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-)
New commits: commit bac6141665049e53c01715a88d46ca04d678ddf0 Author: Laurent Balland-Poirier <laurent.balland-poir...@laposte.net> Date: Fri Mar 17 19:44:10 2017 +0100 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 <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@redhat.com> 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\\ "; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits