[Libreoffice-commits] core.git: starmath/qa

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 5 09:11:16 UTC 2020


 starmath/qa/cppunit/test_cursor.cxx             |   12 ++++--------
 starmath/qa/cppunit/test_nodetotextvisitors.cxx |    9 +++------
 starmath/qa/cppunit/test_starmath.cxx           |    3 +--
 starmath/qa/extras/mmlimport-test.cxx           |   12 ++++--------
 4 files changed, 12 insertions(+), 24 deletions(-)

New commits:
commit c04fcba163c77f3036a581af6b33d6383a277637
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Jun 5 08:18:28 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Jun 5 11:10:42 2020 +0200

    Upcoming loplugin:elidestringvar: starmath
    
    Change-Id: I68e5586ac277825d55e732316626446dd1fc609f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95549
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/starmath/qa/cppunit/test_cursor.cxx b/starmath/qa/cppunit/test_cursor.cxx
index 080e7a274c4d..200af93f2849 100644
--- a/starmath/qa/cppunit/test_cursor.cxx
+++ b/starmath/qa/cppunit/test_cursor.cxx
@@ -67,8 +67,7 @@ void Test::tearDown()
 
 void Test::testCopyPaste()
 {
-    OUString const sInput("a * b + c");
-    auto xTree = SmParser().Parse(sInput);
+    auto xTree = SmParser().Parse("a * b + c");
     xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef, 0);
 
     SmCursor aCursor(xTree.get(), xDocShRef.get());
@@ -90,8 +89,7 @@ void Test::testCopyPaste()
 
 void Test::testCopySelectPaste()
 {
-    OUString const sInput("a * b + c");
-    auto xTree = SmParser().Parse(sInput);
+    auto xTree = SmParser().Parse("a * b + c");
     xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef, 0);
 
     SmCursor aCursor(xTree.get(), xDocShRef.get());
@@ -117,8 +115,7 @@ void Test::testCopySelectPaste()
 
 void Test::testCutPaste()
 {
-    OUString const sInput("a * b + c");
-    auto xTree = SmParser().Parse(sInput);
+    auto xTree = SmParser().Parse("a * b + c");
     xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef, 0);
 
     SmCursor aCursor(xTree.get(), xDocShRef.get());
@@ -140,8 +137,7 @@ void Test::testCutPaste()
 
 void Test::testCutSelectPaste()
 {
-    OUString const sInput("a * b + c");
-    auto xTree = SmParser().Parse(sInput);
+    auto xTree = SmParser().Parse("a * b + c");
     xTree->Prepare(xDocShRef->GetFormat(), *xDocShRef, 0);
 
     SmCursor aCursor(xTree.get(), xDocShRef.get());
diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx b/starmath/qa/cppunit/test_nodetotextvisitors.cxx
index c3172ab60126..5b215584792d 100644
--- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx
+++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx
@@ -576,15 +576,13 @@ void Test::testBinHorInSubSup()
     aCursor.InsertElement(PlusElement);
     aCursor.InsertText("d");
 
-    OUString sExpected = " { a ^ { b + c } + d } ";
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("BinHor in SubSup", sExpected, xDocShRef->GetText());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("BinHor in SubSup", OUString(" { a ^ { b + c } + d } "), xDocShRef->GetText());
 }
 
 void Test::testUnaryInMixedNumberAsNumerator()
 {
     // set up a unary operator
-    OUString sInput = "- 1";
-    auto pTree = SmParser().Parse(sInput);
+    auto pTree = SmParser().Parse("- 1");
     pTree->Prepare(xDocShRef->GetFormat(), *xDocShRef, 0);
 
     SmCursor aCursor(pTree.get(), xDocShRef.get());
@@ -617,8 +615,7 @@ void Test::testUnaryInMixedNumberAsNumerator()
     aCursor.InsertElement(PlusElement);
     aCursor.InsertText("4");
 
-    OUString sExpected = " { 2 { - 1 over 2 } + 4 } ";
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unary in mixed number as Numerator", sExpected, xDocShRef->GetText());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Unary in mixed number as Numerator", OUString(" { 2 { - 1 over 2 } + 4 } "), xDocShRef->GetText());
 }
 
 void Test::testMiscEquivalent()
diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx
index e26bcd31bdfa..20dfd1148110 100644
--- a/starmath/qa/cppunit/test_starmath.cxx
+++ b/starmath/qa/cppunit/test_starmath.cxx
@@ -188,7 +188,6 @@ void Test::editMarker()
     }
 
     {
-        OUString const sTargetText("a under b under c");
         ESelection aSelection;
 
         m_pEditWindow->SelNextMark();
@@ -222,7 +221,7 @@ void Test::editMarker()
 
         m_pEditWindow->Flush();
         OUString sFinalText = m_pEditWindow->GetText();
-        CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be a under b under c", sTargetText, sFinalText);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be a under b under c", OUString("a under b under c"), sFinalText);
     }
 
     {
diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx
index e455e60d84db..5ed9bc86f50a 100644
--- a/starmath/qa/extras/mmlimport-test.cxx
+++ b/starmath/qa/extras/mmlimport-test.cxx
@@ -118,22 +118,19 @@ void Test::testColor()
 void Test::testSimple()
 {
     loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/simple.mml"));
-    OUString const sExpected("left ( {a + b} right )^2");
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", OUString("left ( {a + b} right )^2"), mxDocShell->GetText());
 }
 
 void Test::testNsPrefixMath()
 {
     loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/ns-prefix-math.mml"));
-    OUString const sExpected("left ( {a + b} right )^2");
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", OUString("left ( {a + b} right )^2"), mxDocShell->GetText());
 }
 
 void Test::testMaction()
 {
     loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/maction.mml"));
-    OUString const sExpected("matrix {1 ## 2 ## 3}");
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", OUString("matrix {1 ## 2 ## 3}"), mxDocShell->GetText());
 }
 
 void Test::testMspace()
@@ -145,8 +142,7 @@ void Test::testMspace()
 void Test::testtdf99556()
 {
     loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/tdf99556-1.mml"));
-    OUString const sExpected("sqrt { {} }");
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", OUString("sqrt { {} }"), mxDocShell->GetText());
 }
 
 void Test::testTdf103430()


More information about the Libreoffice-commits mailing list