starmath/qa/extras/mmlexport-test.cxx |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

New commits:
commit 8fa6af450bf148f0033331e5b46154abd5ab72e5
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Feb 4 16:41:24 2025 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Feb 4 21:01:43 2025 +0100

    tdf#127873, tdf#158867: starmath_export: Add unittest
    
    Change-Id: I996f86cbf1bf64f08ec5e9f1b74805a74865880f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181126
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/starmath/qa/extras/mmlexport-test.cxx 
b/starmath/qa/extras/mmlexport-test.cxx
index c0b34afa3f76..55d7001a90a8 100644
--- a/starmath/qa/extras/mmlexport-test.cxx
+++ b/starmath/qa/extras/mmlexport-test.cxx
@@ -33,6 +33,7 @@ public:
     void testTdf101022();
     void testMaj();
     void testHadd();
+    void testTdf158867();
 
     CPPUNIT_TEST_SUITE(MathMLExportTest);
     CPPUNIT_TEST(testBlank);
@@ -40,6 +41,7 @@ public:
     CPPUNIT_TEST(testTdf101022);
     CPPUNIT_TEST(testMaj);
     CPPUNIT_TEST(testHadd);
+    CPPUNIT_TEST(testTdf158867);
     CPPUNIT_TEST_SUITE_END();
 
 protected:
@@ -146,6 +148,21 @@ void MathMLExportTest::testHadd()
     assertXPathContent(pDoc, "/m:math/m:semantics/m:mrow/m:munderover/m:mi", 
u"\U0001EEF1");
 }
 
+void MathMLExportTest::testTdf158867()
+{
+    loadFromURL(u"private:factory/smath"_ustr);
+    SfxBaseModel* pModel = dynamic_cast<SfxBaseModel*>(mxComponent.get());
+    SmDocShell* pDocShell = static_cast<SmDocShell*>(pModel->GetObjectShell());
+    pDocShell->SetText(u"1,2 over 2 = 0,65"_ustr);
+    save(u"MathML XML (Math)"_ustr);
+    xmlDocUniquePtr pDoc = parseXml(maTempFile);
+    CPPUNIT_ASSERT(pDoc);
+    assertXPathContent(pDoc, "/m:math/m:semantics/m:mrow/m:mfrac/m:mn[1]", 
u"1,2");
+    assertXPathContent(pDoc, "/m:math/m:semantics/m:mrow/m:mfrac/m:mn[2]", 
u"2");
+    assertXPathContent(pDoc, "/m:math/m:semantics/m:mrow/m:mo", u"=");
+    assertXPathContent(pDoc, "/m:math/m:semantics/m:mrow/m:mn", u"0,65");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(MathMLExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();

Reply via email to