tdf#152850: Fix bad scoping of MathML frac command

Change-Id: I4f5d0290e522fa6f3faccd26f74540abf848629b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147153
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx
index 0f80f37..d6411f8 100644
--- a/starmath/qa/extras/mmlimport-test.cxx
+++ b/starmath/qa/extras/mmlimport-test.cxx
@@ -160,17 +160,19 @@ void Test::testtdf99556()
void Test::testTdf103430()
{
    loadURL(m_directories.getURLFromSrc(u"starmath/qa/extras/data/tdf103430.mml"));
    CPPUNIT_ASSERT_EQUAL(OUString("frac { { nitalic d ^ 2 nitalic color blue y } } { { color dvip "
                                  "apricot nitalic d font sans bold italic color red x } }"),
                         mxDocShell->GetText());
    CPPUNIT_ASSERT_EQUAL(
        OUString("{ frac { { nitalic d ^ 2 nitalic color blue y } } { { color dvip "
                 "apricot nitalic d font sans bold italic color red x } } }"),
        mxDocShell->GetText());
}

void Test::testTdf103500()
{
    loadURL(m_directories.getURLFromSrc(u"starmath/qa/extras/data/tdf103500.mml"));
    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 } } }"),
                         mxDocShell->GetText());
    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 } } }"),
        mxDocShell->GetText());
}

void Test::testTdf137008()
@@ -200,8 +202,8 @@ void Test::testMathmlEntities()
}

CPPUNIT_TEST_SUITE_REGISTRATION(Test);
}
} // namespace

CPPUNIT_PLUGIN_IMPLEMENT();

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/starmath/source/visitors.cxx b/starmath/source/visitors.cxx
index 6efe993..4225792 100644
--- a/starmath/source/visitors.cxx
+++ b/starmath/source/visitors.cxx
@@ -2305,11 +2305,11 @@ void SmNodeToTextVisitor::Visit( SmBinVerNode* pNode )
    } else{
        SmNode *pNum    = pNode->GetSubNode( 0 ),
               *pDenom  = pNode->GetSubNode( 2 );
        Append(u"frac {");
        Append(u"{ frac {");
        LineToText( pNum );
        Append(u"} {");
        LineToText( pDenom );
        Append(u"}");
        Append(u"} }");
    }
}

diff --git a/uitest/math_tests/tdf128610.py b/uitest/math_tests/tdf128610.py
index 4fdd9c2..29b7d5a 100644
--- a/uitest/math_tests/tdf128610.py
+++ b/uitest/math_tests/tdf128610.py
@@ -27,6 +27,6 @@ class Tdf128610(UITestCase):

            # Without the fix in place, this test would have failed with
            # AssertionError: '{ f _ c = frac { 1 } { K _ m } }' != ''
            self.assertEqual("{ f _ c = frac { 1 } { K _ m } }", get_state_as_dict(xEditView)["Text"])
            self.assertEqual("{ f _ c = { frac { 1 } { K _ m } } }", get_state_as_dict(xEditView)["Text"])

# vim: set shiftwidth=4 softtabstop=4 expandtab: