diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-13 15:16:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-14 10:13:45 +0200 |
commit | b56ca52cef77d4d1f99bc3edd89b2557e5cb2cfb (patch) | |
tree | daf96725c04bcde4538a4861132967d634966601 /starmath/qa | |
parent | 1d83ac544dcd2fbfb0aa19065e16ed82c40d0c86 (diff) |
loplugin:ostr in starmath
Change-Id: Ied15eb71ae3ae2d80ba839a6c99ea3cf620ca52f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167598
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'starmath/qa')
-rw-r--r-- | starmath/qa/cppunit/test_cursor.cxx | 16 | ||||
-rw-r--r-- | starmath/qa/cppunit/test_import.cxx | 2 | ||||
-rw-r--r-- | starmath/qa/cppunit/test_node.cxx | 32 | ||||
-rw-r--r-- | starmath/qa/cppunit/test_nodetotextvisitors.cxx | 24 | ||||
-rw-r--r-- | starmath/qa/cppunit/test_parse.cxx | 10 | ||||
-rw-r--r-- | starmath/qa/cppunit/test_starmath.cxx | 52 | ||||
-rw-r--r-- | starmath/qa/extras/mmlexport-test.cxx | 50 | ||||
-rw-r--r-- | starmath/qa/extras/mmlimport-test.cxx | 70 |
8 files changed, 128 insertions, 128 deletions
diff --git a/starmath/qa/cppunit/test_cursor.cxx b/starmath/qa/cppunit/test_cursor.cxx index 89d4e6fe9a8e..ee442b75f067 100644 --- a/starmath/qa/cppunit/test_cursor.cxx +++ b/starmath/qa/cppunit/test_cursor.cxx @@ -70,7 +70,7 @@ void Test::tearDown() void Test::testCopyPaste() { - auto xTree = SmParser5().Parse("a * b + c"); + auto xTree = SmParser5().Parse(u"a * b + c"_ustr); xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef, 0); SmCursor aCursor(xTree.get(), xDocShRef.get()); @@ -88,13 +88,13 @@ void Test::testCopyPaste() aCursor.Paste(); #ifndef _WIN32 // FIXME: on Windows clipboard does not work in tests for some reason - CPPUNIT_ASSERT_EQUAL(OUString("{ { a * b } + { c * b } }"), xDocShRef->GetText()); + CPPUNIT_ASSERT_EQUAL(u"{ { a * b } + { c * b } }"_ustr, xDocShRef->GetText()); #endif } void Test::testCopySelectPaste() { - auto xTree = SmParser5().Parse("a * b + c"); + auto xTree = SmParser5().Parse(u"a * b + c"_ustr); xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef, 0); SmCursor aCursor(xTree.get(), xDocShRef.get()); @@ -116,13 +116,13 @@ void Test::testCopySelectPaste() aCursor.Paste(); #ifndef _WIN32 // FIXME: on Windows clipboard does not work in tests for some reason - CPPUNIT_ASSERT_EQUAL(OUString("{ { b + { c * b } } + c }"), xDocShRef->GetText()); + CPPUNIT_ASSERT_EQUAL(u"{ { b + { c * b } } + c }"_ustr, xDocShRef->GetText()); #endif } void Test::testCutPaste() { - auto xTree = SmParser5().Parse("a * b + c"); + auto xTree = SmParser5().Parse(u"a * b + c"_ustr); xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef, 0); SmCursor aCursor(xTree.get(), xDocShRef.get()); @@ -140,13 +140,13 @@ void Test::testCutPaste() aCursor.Paste(); #ifndef _WIN32 // FIXME: on Windows clipboard does not work in tests for some reason - CPPUNIT_ASSERT_EQUAL(OUString("{ a + { c * b } }"), xDocShRef->GetText()); + CPPUNIT_ASSERT_EQUAL(u"{ a + { c * b } }"_ustr, xDocShRef->GetText()); #endif } void Test::testCutSelectPaste() { - auto xTree = SmParser5().Parse("a * b + c"); + auto xTree = SmParser5().Parse(u"a * b + c"_ustr); xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef, 0); SmCursor aCursor(xTree.get(), xDocShRef.get()); @@ -168,7 +168,7 @@ void Test::testCutSelectPaste() aCursor.Paste(); #ifndef _WIN32 // FIXME: on Windows clipboard does not work in tests for some reason - CPPUNIT_ASSERT_EQUAL(OUString("{ b + { c * {} } }"), xDocShRef->GetText()); + CPPUNIT_ASSERT_EQUAL(u"{ b + { c * {} } }"_ustr, xDocShRef->GetText()); #endif } diff --git a/starmath/qa/cppunit/test_import.cxx b/starmath/qa/cppunit/test_import.cxx index 984475878eb3..29b618be09cb 100644 --- a/starmath/qa/cppunit/test_import.cxx +++ b/starmath/qa/cppunit/test_import.cxx @@ -23,7 +23,7 @@ class Test : public UnoApiTest { public: Test() - : UnoApiTest("starmath/qa/cppunit/data/") + : UnoApiTest(u"starmath/qa/cppunit/data/"_ustr) { } diff --git a/starmath/qa/cppunit/test_node.cxx b/starmath/qa/cppunit/test_node.cxx index 7b42056fb35e..4e69d2bcb273 100644 --- a/starmath/qa/cppunit/test_node.cxx +++ b/starmath/qa/cppunit/test_node.cxx @@ -68,10 +68,10 @@ void NodeTest::testTdf47813() { SmParser5 aParser; #define MATRIX "matrix {-2#33##4#-5##6,0#7}" - auto pNodeA = aParser.Parse(MATRIX); - auto pNodeC = aParser.Parse("alignc " MATRIX); - auto pNodeL = aParser.Parse("alignl " MATRIX); - auto pNodeR = aParser.Parse("alignr " MATRIX); + auto pNodeA = aParser.Parse(u"" MATRIX ""_ustr); + auto pNodeC = aParser.Parse(u"alignc " MATRIX ""_ustr); + auto pNodeL = aParser.Parse(u"alignl " MATRIX ""_ustr); + auto pNodeR = aParser.Parse(u"alignr " MATRIX ""_ustr); #undef MATRIX ScopedVclPtrInstance<VirtualDevice> pOutputDevice; SmFormat aFmt; @@ -115,26 +115,26 @@ void NodeTest::testTdf52225() { SmFormat aFormat = mxDocShell->GetFormat(); CPPUNIT_ASSERT_EQUAL(sal_Int16(2), aFormat.GetGreekCharStyle()); // default format = 2 - CHECK_GREEK_SYMBOL("%ALPHA", u'\x0391', false); - CHECK_GREEK_SYMBOL("%iALPHA", u'\x0391', true); - CHECK_GREEK_SYMBOL("%alpha", u'\x03b1', true); - CHECK_GREEK_SYMBOL("%ialpha", u'\x03b1', true); + CHECK_GREEK_SYMBOL(u"%ALPHA"_ustr, u'\x0391', false); + CHECK_GREEK_SYMBOL(u"%iALPHA"_ustr, u'\x0391', true); + CHECK_GREEK_SYMBOL(u"%alpha"_ustr, u'\x03b1', true); + CHECK_GREEK_SYMBOL(u"%ialpha"_ustr, u'\x03b1', true); // mode 1 aFormat.SetGreekCharStyle(1); mxDocShell->SetFormat(aFormat); - CHECK_GREEK_SYMBOL("%BETA", u'\x0392', true); - CHECK_GREEK_SYMBOL("%iBETA", u'\x0392', true); - CHECK_GREEK_SYMBOL("%beta", u'\x03b2', true); - CHECK_GREEK_SYMBOL("%ibeta", u'\x03b2', true); + CHECK_GREEK_SYMBOL(u"%BETA"_ustr, u'\x0392', true); + CHECK_GREEK_SYMBOL(u"%iBETA"_ustr, u'\x0392', true); + CHECK_GREEK_SYMBOL(u"%beta"_ustr, u'\x03b2', true); + CHECK_GREEK_SYMBOL(u"%ibeta"_ustr, u'\x03b2', true); // mode 0 aFormat.SetGreekCharStyle(0); mxDocShell->SetFormat(aFormat); - CHECK_GREEK_SYMBOL("%GAMMA", u'\x0393', false); - CHECK_GREEK_SYMBOL("%iGAMMA", u'\x0393', true); - CHECK_GREEK_SYMBOL("%gamma", u'\x03b3', false); - CHECK_GREEK_SYMBOL("%igamma", u'\x03b3', true); + CHECK_GREEK_SYMBOL(u"%GAMMA"_ustr, u'\x0393', false); + CHECK_GREEK_SYMBOL(u"%iGAMMA"_ustr, u'\x0393', true); + CHECK_GREEK_SYMBOL(u"%gamma"_ustr, u'\x03b3', false); + CHECK_GREEK_SYMBOL(u"%igamma"_ustr, u'\x03b3', true); #undef CHECK_GREEK_SYMBOL } diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx b/starmath/qa/cppunit/test_nodetotextvisitors.cxx index 0fbcfa1a81a1..3a0f55700870 100644 --- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx +++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx @@ -524,7 +524,7 @@ void Test::testBinomInBinHor() // tack +d on the end, which will put the binom into an SmBinHorNode aCursor.InsertElement(PlusElement); - aCursor.InsertText("d"); + aCursor.InsertText(u"d"_ustr); sExpected += "{ { binom a { b + c } } + d }"; CPPUNIT_ASSERT_EQUAL_MESSAGE("Binom Node in BinHor Node", sExpected, xDocShRef->GetText()); @@ -552,7 +552,7 @@ void Test::testBinVerInUnary() // set up a fraction aCursor.InsertFraction(); aCursor.Move(pOutputDevice, MoveDown); - aCursor.InsertText("2"); + aCursor.InsertText(u"2"_ustr); sExpected += "- { 1 over 2 }"; CPPUNIT_ASSERT_EQUAL_MESSAGE("Binary Vertical in Unary Operator", sExpected, @@ -569,25 +569,25 @@ void Test::testBinHorInSubSup() ScopedVclPtrInstance<VirtualDevice> pOutputDevice; // Insert an RSup expression with a BinHor for the exponent - aCursor.InsertText("a"); + aCursor.InsertText(u"a"_ustr); aCursor.InsertSubSup(RSUP); - aCursor.InsertText("b"); + aCursor.InsertText(u"b"_ustr); aCursor.InsertElement(PlusElement); - aCursor.InsertText("c"); + aCursor.InsertText(u"c"_ustr); // Move to the end and add d to the expression aCursor.Move(pOutputDevice, MoveRight); aCursor.InsertElement(PlusElement); - aCursor.InsertText("d"); + aCursor.InsertText(u"d"_ustr); - CPPUNIT_ASSERT_EQUAL_MESSAGE("BinHor in SubSup", OUString("{ a ^ { b + c } + d }"), + CPPUNIT_ASSERT_EQUAL_MESSAGE("BinHor in SubSup", u"{ a ^ { b + c } + d }"_ustr, xDocShRef->GetText()); } void Test::testUnaryInMixedNumberAsNumerator() { // set up a unary operator - auto pTree = SmParser5().Parse("- 1"); + auto pTree = SmParser5().Parse(u"- 1"_ustr); pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef, 0); SmCursor aCursor(pTree.get(), xDocShRef.get()); @@ -604,13 +604,13 @@ void Test::testUnaryInMixedNumberAsNumerator() // Set up a fraction aCursor.InsertFraction(); aCursor.Move(pOutputDevice, MoveDown); - aCursor.InsertText("2"); + aCursor.InsertText(u"2"_ustr); // Move left and turn this into a mixed number // (bad form, but this could happen right?) aCursor.Move(pOutputDevice, MoveLeft); aCursor.Move(pOutputDevice, MoveLeft); - aCursor.InsertText("2"); + aCursor.InsertText(u"2"_ustr); // move forward (more than) enough places to be at the end for (size_t i = 0; i < 8; ++i) @@ -618,10 +618,10 @@ void Test::testUnaryInMixedNumberAsNumerator() // add 4 to the end aCursor.InsertElement(PlusElement); - aCursor.InsertText("4"); + aCursor.InsertText(u"4"_ustr); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unary in mixed number as Numerator", - OUString("{ 2 { { - 1 over 2 } + 4 } }"), xDocShRef->GetText()); + u"{ 2 { { - 1 over 2 } + 4 } }"_ustr, xDocShRef->GetText()); } void Test::testMiscEquivalent() diff --git a/starmath/qa/cppunit/test_parse.cxx b/starmath/qa/cppunit/test_parse.cxx index 2e240c04a2ac..0cffe2cbce83 100644 --- a/starmath/qa/cppunit/test_parse.cxx +++ b/starmath/qa/cppunit/test_parse.cxx @@ -63,7 +63,7 @@ void ParseTest::tearDown() */ void ParseTest::testMinus() { - auto pNode = SmParser5().Parse("-1.2"); + auto pNode = SmParser5().Parse(u"-1.2"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(1), pNode->GetNumSubNodes()); const SmNode *pNode0 = pNode->GetSubNode(0); CPPUNIT_ASSERT(pNode0); @@ -79,14 +79,14 @@ void ParseTest::testMinus() // GetText() vs GetToken().aText CPPUNIT_ASSERT_EQUAL(OUString(MS_MINUS), static_cast<const SmMathSymbolNode *>(pNode000)->GetText()); - CPPUNIT_ASSERT_EQUAL(OUString("-"), + CPPUNIT_ASSERT_EQUAL(u"-"_ustr, static_cast<const SmMathSymbolNode *>(pNode000)->GetToken().aText); const SmNode *pNode001 = pNode00->GetSubNode(1); CPPUNIT_ASSERT(pNode001); CPPUNIT_ASSERT_EQUAL(SmNodeType::Text, pNode001->GetType()); // GetText() vs GetToken().aText CPPUNIT_ASSERT(static_cast<const SmTextNode *>(pNode001)->GetText().isEmpty()); - CPPUNIT_ASSERT_EQUAL(OUString("1.2"), + CPPUNIT_ASSERT_EQUAL(u"1.2"_ustr, static_cast<const SmTextNode *>(pNode001)->GetToken().aText); } @@ -96,7 +96,7 @@ void ParseTest::testMinus() */ void ParseTest::testNospace() { - auto pNode = SmParser5().Parse("nospace{ nitalic d {F(x) G(x)} }"); + auto pNode = SmParser5().Parse(u"nospace{ nitalic d {F(x) G(x)} }"_ustr); CPPUNIT_ASSERT_EQUAL(size_t(1), pNode->GetNumSubNodes()); const SmNode *pNode0 = pNode->GetSubNode(0); CPPUNIT_ASSERT(pNode0); @@ -110,7 +110,7 @@ void ParseTest::testNospace() const SmNode *pNode000 = pNode00->GetSubNode(0); CPPUNIT_ASSERT(pNode000); CPPUNIT_ASSERT_EQUAL(SmNodeType::Font, pNode000->GetType()); - CPPUNIT_ASSERT_EQUAL(OUString("nitalic"), + CPPUNIT_ASSERT_EQUAL(u"nitalic"_ustr, static_cast<const SmFontNode *>(pNode000)->GetToken().aText); const SmNode *pNode001 = pNode00->GetSubNode(1); CPPUNIT_ASSERT(pNode001); diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx index 79b1bd461181..8dd6bc0b22ba 100644 --- a/starmath/qa/cppunit/test_starmath.cxx +++ b/starmath/qa/cppunit/test_starmath.cxx @@ -148,7 +148,7 @@ void Test::testSmTmpDeviceRestoreFont() { ScopedVclPtrInstance<Printer> pPrinter; - OUString aFontName("Linux Libertine G"); + OUString aFontName(u"Linux Libertine G"_ustr); CPPUNIT_ASSERT(pPrinter->IsFontAvailable(aFontName)); vcl::Font aOriginalFont = pPrinter->GetFont(); @@ -178,7 +178,7 @@ void Test::editMarker() { SmEditWindow& rEditWindow = m_pSmCmdBoxWindow->GetEditWindow(); { - OUString sMarkedText("<?> under <?> under <?>"); + OUString sMarkedText(u"<?> under <?> under <?>"_ustr); rEditWindow.SetText(sMarkedText); rEditWindow.Flush(); OUString sFinalText = rEditWindow.GetText(); @@ -190,12 +190,12 @@ void Test::editMarker() rEditWindow.SelNextMark(); rEditWindow.Delete(); - rEditWindow.InsertText("a"); + rEditWindow.InsertText(u"a"_ustr); rEditWindow.SelNextMark(); rEditWindow.SelNextMark(); rEditWindow.Delete(); - rEditWindow.InsertText("c"); + rEditWindow.InsertText(u"c"_ustr); // should be safe i.e. do nothing rEditWindow.SelNextMark(); @@ -207,7 +207,7 @@ void Test::editMarker() rEditWindow.SelPrevMark(); rEditWindow.Delete(); - rEditWindow.InsertText("b"); + rEditWindow.InsertText(u"b"_ustr); // tdf#106116: should be safe i.e. do nothing rEditWindow.SelPrevMark(); @@ -219,7 +219,7 @@ void Test::editMarker() rEditWindow.Flush(); OUString sFinalText = rEditWindow.GetText(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be a under b under c", OUString("a under b under c"), sFinalText); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be a under b under c", u"a under b under c"_ustr, sFinalText); } { @@ -230,7 +230,7 @@ void Test::editMarker() void Test::editFailure() { - m_xDocShRef->SetText("color a b over {a/}"); + m_xDocShRef->SetText(u"color a b over {a/}"_ustr); const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); @@ -263,7 +263,7 @@ void Test::editFailure() void Test::ParseErrorUnexpectedToken() { - m_xDocShRef->SetText("\\foo"); + m_xDocShRef->SetText(u"\\foo"_ustr); const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); CPPUNIT_ASSERT(pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::UnexpectedToken expected", @@ -272,7 +272,7 @@ void Test::ParseErrorUnexpectedToken() void Test::ParseErrorPoundExpected() { - m_xDocShRef->SetText("matrix {1#2##a##b#c}"); + m_xDocShRef->SetText(u"matrix {1#2##a##b#c}"_ustr); const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); CPPUNIT_ASSERT(pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::PoundExpected expected", @@ -281,7 +281,7 @@ void Test::ParseErrorPoundExpected() void Test::ParseErrorColorExpected() { - m_xDocShRef->SetText("color 42 x"); + m_xDocShRef->SetText(u"color 42 x"_ustr); const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); CPPUNIT_ASSERT(pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::ColorExpected expected", @@ -290,7 +290,7 @@ void Test::ParseErrorColorExpected() void Test::ParseErrorLgroupExpected() { - m_xDocShRef->SetText("stack 42"); + m_xDocShRef->SetText(u"stack 42"_ustr); const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); CPPUNIT_ASSERT(pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::LgroupExpected expected", @@ -299,7 +299,7 @@ void Test::ParseErrorLgroupExpected() void Test::ParseErrorRgroupExpected() { - m_xDocShRef->SetText("stack {a#b#c)"); + m_xDocShRef->SetText(u"stack {a#b#c)"_ustr); const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); CPPUNIT_ASSERT(pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::RgroupExpected expected", @@ -308,7 +308,7 @@ void Test::ParseErrorRgroupExpected() void Test::ParseErrorLbraceExpected() { - m_xDocShRef->SetText("left 42"); + m_xDocShRef->SetText(u"left 42"_ustr); const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); CPPUNIT_ASSERT(pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::LbraceExpected expected", @@ -317,7 +317,7 @@ void Test::ParseErrorLbraceExpected() void Test::ParseErrorRbraceExpected() { - m_xDocShRef->SetText("left ( foo right x"); + m_xDocShRef->SetText(u"left ( foo right x"_ustr); const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); CPPUNIT_ASSERT(pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::RbraceExpected expected", @@ -326,7 +326,7 @@ void Test::ParseErrorRbraceExpected() void Test::ParseErrorParentMismatch() { - m_xDocShRef->SetText("lbrace foo rceil"); + m_xDocShRef->SetText(u"lbrace foo rceil"_ustr); const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); CPPUNIT_ASSERT(pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::ParentMismatch expected", @@ -335,7 +335,7 @@ void Test::ParseErrorParentMismatch() void Test::ParseErrorRightExpected() { - m_xDocShRef->SetText("left ( x mline y )"); + m_xDocShRef->SetText(u"left ( x mline y )"_ustr); const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); CPPUNIT_ASSERT(pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::RightExpected expected", @@ -344,7 +344,7 @@ void Test::ParseErrorRightExpected() void Test::ParseErrorFontExpected() { - m_xDocShRef->SetText("font small bar"); + m_xDocShRef->SetText(u"font small bar"_ustr); const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); CPPUNIT_ASSERT(pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::FontExpected expected", @@ -353,7 +353,7 @@ void Test::ParseErrorFontExpected() void Test::ParseErrorSizeExpected() { - m_xDocShRef->SetText("size small baz"); + m_xDocShRef->SetText(u"size small baz"_ustr); const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); CPPUNIT_ASSERT(pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::SizeExpected expected", @@ -362,7 +362,7 @@ void Test::ParseErrorSizeExpected() void Test::ParseErrorDoubleAlign() { - m_xDocShRef->SetText("alignl alignc x"); + m_xDocShRef->SetText(u"alignl alignc x"_ustr); const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); CPPUNIT_ASSERT(pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::DoubleAlign expected", @@ -371,7 +371,7 @@ void Test::ParseErrorDoubleAlign() void Test::ParseErrorDoubleSubsupscript() { - m_xDocShRef->SetText("x_y_z"); + m_xDocShRef->SetText(u"x_y_z"_ustr); const SmErrorDesc *pErrorDesc = m_xDocShRef->GetParser()->NextError(); CPPUNIT_ASSERT(pErrorDesc); CPPUNIT_ASSERT_EQUAL_MESSAGE("SmParseError::DoubleSubsupscript expected", @@ -382,7 +382,7 @@ void Test::editUndoRedo() { EditEngine &rEditEngine = m_xDocShRef->GetEditEngine(); - OUString sStringOne("a under b"); + OUString sStringOne(u"a under b"_ustr); { rEditEngine.SetText(0, sStringOne); m_xDocShRef->UpdateText(); @@ -391,7 +391,7 @@ void Test::editUndoRedo() } { - OUString sStringTwo("a over b"); + OUString sStringTwo(u"a over b"_ustr); rEditEngine.SetText(0, sStringTwo); m_xDocShRef->UpdateText(); OUString sFinalText = m_xDocShRef->GetText(); @@ -437,11 +437,11 @@ void Test::replacePlaceholder() SmEditWindow& rEditWindow = m_pSmCmdBoxWindow->GetEditWindow(); // Test the placeholder replacement. In this case, testing 'a + b', it // should return '+a + b' when selecting '+<?>' in ElementsDock - rEditWindow.SetText("a + b"); + rEditWindow.SetText(u"a + b"_ustr); rEditWindow.SelectAll(); - rEditWindow.InsertText("+<?>"); + rEditWindow.InsertText(u"+<?>"_ustr); OUString sFinalText = rEditWindow.GetText(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be '+a + b'", OUString("+a + b"), sFinalText); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be '+a + b'", u"+a + b"_ustr, sFinalText); } void Test::viewZoom() @@ -451,7 +451,7 @@ void Test::viewZoom() EditEngine &rEditEngine = m_xDocShRef->GetEditEngine(); { - OUString sStringOne("a under b"); + OUString sStringOne(u"a under b"_ustr); rEditEngine.SetText(0, sStringOne); m_xDocShRef->UpdateText(); OUString sFinalText = m_xDocShRef->GetText(); diff --git a/starmath/qa/extras/mmlexport-test.cxx b/starmath/qa/extras/mmlexport-test.cxx index 402df43130d5..63ee1feb1f4d 100644 --- a/starmath/qa/extras/mmlexport-test.cxx +++ b/starmath/qa/extras/mmlexport-test.cxx @@ -24,7 +24,7 @@ class MathMLExportTest : public UnoApiXmlTest { public: MathMLExportTest() - : UnoApiXmlTest("starmath/qa/extras/data/") + : UnoApiXmlTest(u"starmath/qa/extras/data/"_ustr) { } @@ -55,27 +55,27 @@ void MathMLExportTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) void MathMLExportTest::testBlank() { - mxComponent = loadFromDesktop("private:factory/smath"); + mxComponent = loadFromDesktop(u"private:factory/smath"_ustr); SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); - pDocShell->SetText("x`y~~z"); - save("MathML XML (Math)"); + pDocShell->SetText(u"x`y~~z"_ustr); + save(u"MathML XML (Math)"_ustr); xmlDocUniquePtr pDoc = parseXml(maTempFile); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mspace[1]"_ostr, "width"_ostr, "0.5em"); - assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mspace[2]"_ostr, "width"_ostr, "4em"); + assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mspace[1]"_ostr, "width"_ostr, u"0.5em"_ustr); + assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mspace[2]"_ostr, "width"_ostr, u"4em"_ustr); } void MathMLExportTest::testTdf97049() { - mxComponent = loadFromDesktop("private:factory/smath"); + mxComponent = loadFromDesktop(u"private:factory/smath"_ustr); SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); - pDocShell->SetText("intd {{1 over x} dx}"); - save("MathML XML (Math)"); + pDocShell->SetText(u"intd {{1 over x} dx}"_ustr); + save(u"MathML XML (Math)"_ustr); xmlDocUniquePtr pDoc = parseXml(maTempFile); CPPUNIT_ASSERT(pDoc); - assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mo[1]"_ostr, "stretchy"_ostr, "true"); + assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mo[1]"_ostr, "stretchy"_ostr, u"true"_ustr); auto aContent = getXPathContent(pDoc, "/m:math/m:semantics/m:mrow/m:mo[1]"_ostr); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), aContent.getLength()); CPPUNIT_ASSERT_EQUAL(u'\x222B', aContent[0]); @@ -83,35 +83,37 @@ void MathMLExportTest::testTdf97049() void MathMLExportTest::checkMathVariant(SmDocShell& rDocShell, bool bCapital, bool bSmall) { - rDocShell.SetText("%GAMMA %iGAMMA {ital %GAMMA} {nitalic %iGAMMA} " - "%gamma %igamma {ital %gamma} {nitalic %igamma}"); - save("MathML XML (Math)"); + rDocShell.SetText(u"%GAMMA %iGAMMA {ital %GAMMA} {nitalic %iGAMMA} " + "%gamma %igamma {ital %gamma} {nitalic %igamma}"_ustr); + save(u"MathML XML (Math)"_ustr); xmlDocUniquePtr pDoc = parseXml(maTempFile); CPPUNIT_ASSERT(pDoc); if (bCapital) assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mi[1]"_ostr, "mathvariant"_ostr); else - assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mi[1]"_ostr, "mathvariant"_ostr, "normal"); + assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mi[1]"_ostr, "mathvariant"_ostr, + u"normal"_ustr); assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mstyle[1]/m:mi[1]"_ostr, "mathvariant"_ostr); assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mi[2]"_ostr, "mathvariant"_ostr); assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mstyle[2]/m:mi[1]"_ostr, "mathvariant"_ostr, - "normal"); + u"normal"_ustr); if (bSmall) assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mi[3]"_ostr, "mathvariant"_ostr); else - assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mi[3]"_ostr, "mathvariant"_ostr, "normal"); + assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mi[3]"_ostr, "mathvariant"_ostr, + u"normal"_ustr); assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mstyle[3]/m:mi[1]"_ostr, "mathvariant"_ostr); assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mi[4]"_ostr, "mathvariant"_ostr); assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mstyle[4]/m:mi[1]"_ostr, "mathvariant"_ostr, - "normal"); - rDocShell.SetText(""); + u"normal"_ustr); + rDocShell.SetText(u""_ustr); } void MathMLExportTest::testTdf101022() { - mxComponent = loadFromDesktop("private:factory/smath"); + mxComponent = loadFromDesktop(u"private:factory/smath"_ustr); SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); @@ -126,27 +128,27 @@ void MathMLExportTest::testTdf101022() void MathMLExportTest::testMaj() { - mxComponent = loadFromDesktop("private:factory/smath"); + mxComponent = loadFromDesktop(u"private:factory/smath"_ustr); SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); pDocShell->SetText( u"maj to { \u0661 } from { \U0001EE0A = \u0660 } { \u0661 over \U0001EE0A }"_ustr); - save("MathML XML (Math)"); + save(u"MathML XML (Math)"_ustr); xmlDocUniquePtr pDoc = parseXml(maTempFile); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:munderover/m:mo"_ostr, "stretchy"_ostr, - "false"); + u"false"_ustr); assertXPathContent(pDoc, "/m:math/m:semantics/m:mrow/m:munderover/m:mo"_ostr, u"\U0001EEF0"_ustr); } void MathMLExportTest::testHadd() { - mxComponent = loadFromDesktop("private:factory/smath"); + mxComponent = loadFromDesktop(u"private:factory/smath"_ustr); SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); pDocShell->SetText(u"hadd to { \U0001EE4E } from { \U0001EE4E } \U0001EE4E"_ustr); - save("MathML XML (Math)"); + save(u"MathML XML (Math)"_ustr); xmlDocUniquePtr pDoc = parseXml(maTempFile); CPPUNIT_ASSERT(pDoc); assertXPathContent(pDoc, "/m:math/m:semantics/m:mrow/m:munderover/m:mi"_ostr, diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx index d57dee0aa7f3..1d4a0cf00364 100644 --- a/starmath/qa/extras/mmlimport-test.cxx +++ b/starmath/qa/extras/mmlimport-test.cxx @@ -21,7 +21,7 @@ class Test : public UnoApiTest { public: Test() - : UnoApiTest("starmath/qa/extras/data/") + : UnoApiTest(u"starmath/qa/extras/data/"_ustr) { } @@ -61,26 +61,26 @@ void Test::testColor() loadFromFile(u"color.mml"); SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); - CPPUNIT_ASSERT_EQUAL(OUString("{ color black b" - " color white w" - " color red r" - " color green g" - " color blue b" - " color yellow y" - " color silver s" - " color gray g" - " color maroon m" - " color purple p" - " color lime l" - " color olive o" - " color navy n" - " color teal t" - " color aqua a" - " color fuchsia f" - " color crimson c" - " color dvip apricot" - " a color yellow y" - " color rgb 220 20 61 x }"), + CPPUNIT_ASSERT_EQUAL(u"{ color black b" + " color white w" + " color red r" + " color green g" + " color blue b" + " color yellow y" + " color silver s" + " color gray g" + " color maroon m" + " color purple p" + " color lime l" + " color olive o" + " color navy n" + " color teal t" + " color aqua a" + " color fuchsia f" + " color crimson c" + " color dvip apricot" + " a color yellow y" + " color rgb 220 20 61 x }"_ustr, pDocShell->GetText()); } @@ -89,7 +89,7 @@ void Test::testSimple() loadFromFile(u"simple.mml"); SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", OUString("left ( { a + b } right ) ^ 2"), + CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", u"left ( { a + b } right ) ^ 2"_ustr, pDocShell->GetText()); } @@ -98,7 +98,7 @@ void Test::testNsPrefixMath() loadFromFile(u"ns-prefix-math.mml"); SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", OUString("left ( { a + b } right ) ^ 2"), + CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", u"left ( { a + b } right ) ^ 2"_ustr, pDocShell->GetText()); } @@ -107,7 +107,7 @@ void Test::testMaction() loadFromFile(u"maction.mml"); SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", OUString("matrix{ 1 ## 2 ## 3 }"), + CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", u"matrix{ 1 ## 2 ## 3 }"_ustr, pDocShell->GetText()); } @@ -116,7 +116,7 @@ void Test::testMspace() loadFromFile(u"mspace.mml"); SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); - CPPUNIT_ASSERT_EQUAL(OUString("{ a b ~ c ~~``` d }"), pDocShell->GetText()); + CPPUNIT_ASSERT_EQUAL(u"{ a b ~ c ~~``` d }"_ustr, pDocShell->GetText()); } void Test::testtdf99556() @@ -124,7 +124,7 @@ void Test::testtdf99556() loadFromFile(u"tdf99556-1.mml"); SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); - CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", OUString("sqrt { }"), pDocShell->GetText()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", u"sqrt { }"_ustr, pDocShell->GetText()); } void Test::testTdf103430() @@ -132,10 +132,9 @@ void Test::testTdf103430() loadFromFile(u"tdf103430.mml"); SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); - CPPUNIT_ASSERT_EQUAL( - OUString("{ frac { { nitalic d ^ 2 nitalic color blue y } } { { color dvip " - "apricot nitalic d font sans bold italic color red x } } }"), - pDocShell->GetText()); + CPPUNIT_ASSERT_EQUAL(u"{ frac { { nitalic d ^ 2 nitalic color blue y } } { { color dvip " + "apricot nitalic d font sans bold italic color red x } } }"_ustr, + pDocShell->GetText()); } void Test::testTdf103500() @@ -143,10 +142,9 @@ void Test::testTdf103500() loadFromFile(u"tdf103500.mml"); SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); - CPPUNIT_ASSERT_EQUAL( - OUString("{ { int csup b csub a { { frac { 1 } { x } } ` nitalic d x } } = { " - "intd csup b csub a { { frac { 1 } { y } } ` nitalic d y } } }"), - pDocShell->GetText()); + CPPUNIT_ASSERT_EQUAL(u"{ { int csup b csub a { { frac { 1 } { x } } ` nitalic d x } } = { " + "intd csup b csub a { { frac { 1 } { y } } ` nitalic d y } } }"_ustr, + pDocShell->GetText()); } void Test::testTdf137008() @@ -155,7 +153,7 @@ void Test::testTdf137008() loadFromFile(u"tdf137008.mml"); SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); - CPPUNIT_ASSERT_EQUAL(OUString("matrix{ { } # ## # }"), pDocShell->GetText()); + CPPUNIT_ASSERT_EQUAL(u"matrix{ { } # ## # }"_ustr, pDocShell->GetText()); } void Test::testTdf151842() @@ -164,7 +162,7 @@ void Test::testTdf151842() loadFromFile(u"tdf151842.odf"); SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell()); - CPPUNIT_ASSERT_EQUAL(OUString("test"), pDocShell->GetText()); + CPPUNIT_ASSERT_EQUAL(u"test"_ustr, pDocShell->GetText()); SmFormat aFormat = pDocShell->GetFormat(); // Without the fix in place, this test would have failed with |