From d4e284ab44f4644a60eea50052f7940098541145 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 13 May 2016 13:03:55 +0100 Subject: Resolves: tdf#99556 if the num of arguments is not 1 infer a row not just if the num of arguments is > 1 (cherry picked from commit eb2da27e0834925d449373593fb650db49671adf) Change-Id: If0cae16cc52685315708ac3b2b8456ede7c1a6ce Reviewed-on: https://gerrit.libreoffice.org/24963 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- starmath/qa/extras/data/tdf99556-1.mml | 3 +++ starmath/qa/extras/mmlimport-test.cxx | 10 ++++++++++ starmath/source/mathmlimport.cxx | 10 +++++----- 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 starmath/qa/extras/data/tdf99556-1.mml (limited to 'starmath') diff --git a/starmath/qa/extras/data/tdf99556-1.mml b/starmath/qa/extras/data/tdf99556-1.mml new file mode 100644 index 000000000000..0eae8b2df252 --- /dev/null +++ b/starmath/qa/extras/data/tdf99556-1.mml @@ -0,0 +1,3 @@ + + + diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx index 43130190c6e4..db18fe11c8fe 100644 --- a/starmath/qa/extras/mmlimport-test.cxx +++ b/starmath/qa/extras/mmlimport-test.cxx @@ -32,11 +32,13 @@ public: void testSimple(); void testNsPrefixMath(); void testMaction(); + void testtdf99556(); CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testSimple); CPPUNIT_TEST(testNsPrefixMath); CPPUNIT_TEST(testMaction); + CPPUNIT_TEST(testtdf99556); CPPUNIT_TEST_SUITE_END(); private: @@ -103,6 +105,14 @@ void Test::testMaction() CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText()); } +void Test::testtdf99556() +{ + loadURL(getURLFromSrc("starmath/qa/extras/data/tdf99556-1.mml")); + OUString sExpected("sqrt"); + CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText()); +} + + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index 48c0d488a727..3e983078aaa5 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -800,7 +800,7 @@ void SmXMLEncloseContext_Impl::EndElement() contents are treated as a single "inferred " containing its arguments */ - if (GetSmImport().GetNodeStack().size() - nElementCount > 1) + if (GetSmImport().GetNodeStack().size() - nElementCount != 1) SmXMLRowContext_Impl::EndElement(); } @@ -873,7 +873,7 @@ void SmXMLStyleContext_Impl::EndElement() arguments */ SmNodeStack &rNodeStack = GetSmImport().GetNodeStack(); - if (rNodeStack.size() - nElementCount > 1) + if (rNodeStack.size() - nElementCount != 1) SmXMLRowContext_Impl::EndElement(); aStyleHelper.ApplyAttrs(); } @@ -898,7 +898,7 @@ void SmXMLPaddedContext_Impl::EndElement() contents are treated as a single "inferred " containing its arguments */ - if (GetSmImport().GetNodeStack().size() - nElementCount > 1) + if (GetSmImport().GetNodeStack().size() - nElementCount != 1) SmXMLRowContext_Impl::EndElement(); } @@ -922,7 +922,7 @@ void SmXMLPhantomContext_Impl::EndElement() contents are treated as a single "inferred " containing its arguments */ - if (GetSmImport().GetNodeStack().size() - nElementCount > 1) + if (GetSmImport().GetNodeStack().size() - nElementCount != 1) SmXMLRowContext_Impl::EndElement(); SmToken aToken; @@ -2201,7 +2201,7 @@ void SmXMLSqrtContext_Impl::EndElement() contents are treated as a single "inferred " containing its arguments */ - if (GetSmImport().GetNodeStack().size() - nElementCount > 1) + if (GetSmImport().GetNodeStack().size() - nElementCount != 1) SmXMLRowContext_Impl::EndElement(); SmToken aToken; -- cgit