diff options
author | Khaled Hosny <khaled@libreoffice.org> | 2023-09-07 10:21:24 +0300 |
---|---|---|
committer | خالد حسني <khaled@libreoffice.org> | 2023-09-07 16:18:28 +0200 |
commit | 8c982bf86ff9ca5a4ed86505ec1133cc183f1b58 (patch) | |
tree | 65d27e550d7cd972b103601a931e56b01ee49602 /starmath/qa | |
parent | e59516e8b31f0a1880de153229f5b193a447fb60 (diff) |
tdf#130741: Insert brackets around horizontal binary nodes more generously
When converting node tree creating with visual editor back to text for
the command editor, try to always insert brackets around binary
expressions. It might look redundant at times but it is safer, and the
code is not supposed to be edited by hand anymore so doesn’t have to
look pretty.
Change-Id: Ifff574494c9e8f8b948e432f6832d88c334aba00
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156640
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@libreoffice.org>
Diffstat (limited to 'starmath/qa')
-rw-r--r-- | starmath/qa/cppunit/test_cursor.cxx | 10 | ||||
-rw-r--r-- | starmath/qa/cppunit/test_nodetotextvisitors.cxx | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/starmath/qa/cppunit/test_cursor.cxx b/starmath/qa/cppunit/test_cursor.cxx index 5f4c551675a1..bbdebf503153 100644 --- a/starmath/qa/cppunit/test_cursor.cxx +++ b/starmath/qa/cppunit/test_cursor.cxx @@ -87,7 +87,7 @@ void Test::testCopyPaste() aCursor.Move(pOutputDevice, MoveRight); aCursor.Paste(); - CPPUNIT_ASSERT_EQUAL(OUString("{ a * b + c * b }"), xDocShRef->GetText()); + CPPUNIT_ASSERT_EQUAL(OUString("{ { a * b } + { c * b } }"), xDocShRef->GetText()); } void Test::testCopySelectPaste() @@ -113,7 +113,7 @@ void Test::testCopySelectPaste() aCursor.Move(pOutputDevice, MoveRight, false); aCursor.Paste(); - CPPUNIT_ASSERT_EQUAL(OUString("{ b + c * b + c }"), xDocShRef->GetText()); + CPPUNIT_ASSERT_EQUAL(OUString("{ { b + { c * b } } + c }"), xDocShRef->GetText()); } void Test::testCutPaste() @@ -130,12 +130,12 @@ void Test::testCutPaste() aCursor.Move(pOutputDevice, MoveRight, false); aCursor.Move(pOutputDevice, MoveRight, false); aCursor.Cut(); - // go to the left end and then paste + // go to the right end and then paste aCursor.Move(pOutputDevice, MoveRight); aCursor.Move(pOutputDevice, MoveRight); aCursor.Paste(); - CPPUNIT_ASSERT_EQUAL(OUString("{ a + c * b }"), xDocShRef->GetText()); + CPPUNIT_ASSERT_EQUAL(OUString("{ a + { c * b } }"), xDocShRef->GetText()); } void Test::testCutSelectPaste() @@ -161,7 +161,7 @@ void Test::testCutSelectPaste() aCursor.Move(pOutputDevice, MoveRight, false); aCursor.Paste(); - CPPUNIT_ASSERT_EQUAL(OUString("{ b + c * }"), xDocShRef->GetText()); + CPPUNIT_ASSERT_EQUAL(OUString("{ b + { c * } }"), xDocShRef->GetText()); } CPPUNIT_TEST_SUITE_REGISTRATION(Test); diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx b/starmath/qa/cppunit/test_nodetotextvisitors.cxx index 11ef5affcc4c..aba582e281d3 100644 --- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx +++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx @@ -528,7 +528,7 @@ void Test::testBinomInBinHor() aCursor.InsertElement(PlusElement); aCursor.InsertText("d"); - sExpected += "{ { binom a b + c } + d }"; + sExpected += "{ { binom a { b + c } } + d }"; CPPUNIT_ASSERT_EQUAL_MESSAGE("Binom Node in BinHor Node", sExpected, xDocShRef->GetText()); } @@ -623,7 +623,7 @@ void Test::testUnaryInMixedNumberAsNumerator() aCursor.InsertText("4"); CPPUNIT_ASSERT_EQUAL_MESSAGE("Unary in mixed number as Numerator", - OUString("{ 2 { - 1 over 2 } + 4 }"), xDocShRef->GetText()); + OUString("{ 2 { { - 1 over 2 } + 4 } }"), xDocShRef->GetText()); } void Test::testMiscEquivalent() |