tdf#103500 Import stretchy integral symbol from MathML
as "intd".
Change-Id: Ic8a4feef7a3a19c8ed5bca2f09f80901e2b6d343
Reviewed-on: https://gerrit.libreoffice.org/30953
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
diff --git a/starmath/qa/extras/data/tdf103500.mml b/starmath/qa/extras/data/tdf103500.mml
new file mode 100644
index 0000000..7c49669
--- /dev/null
+++ b/starmath/qa/extras/data/tdf103500.mml
@@ -0,0 +1,41 @@
<math xmlns="http://www.w3.org/1998/Math/MathML">
<mrow>
<mrow>
<munderover>
<mo stretchy="false">∫</mo>
<mi>a</mi>
<mi>b</mi>
</munderover>
<mrow>
<mfrac>
<mn>1</mn>
<mi>x</mi>
</mfrac>
<mspace width="0.5em"/>
<mstyle mathvariant="normal">
<mi mathvariant="normal">d</mi>
</mstyle>
<mi>x</mi>
</mrow>
</mrow>
<mo stretchy="false">=</mo>
<mrow>
<munderover>
<mo stretchy="true">∫</mo>
<mi>a</mi>
<mi>b</mi>
</munderover>
<mrow>
<mfrac>
<mn>1</mn>
<mi>y</mi>
</mfrac>
<mspace width="0.5em"/>
<mstyle mathvariant="normal">
<mi mathvariant="normal">d</mi>
</mstyle>
<mi>y</mi>
</mrow>
</mrow>
</mrow>
</math>
diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx
index 9bbc08a..3db697f 100644
--- a/starmath/qa/extras/mmlimport-test.cxx
+++ b/starmath/qa/extras/mmlimport-test.cxx
@@ -34,6 +34,7 @@ public:
void testMaction();
void testMspace();
void testtdf99556();
void testTdf103500();
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testSimple);
@@ -41,6 +42,7 @@ public:
CPPUNIT_TEST(testMaction);
CPPUNIT_TEST(testMspace);
CPPUNIT_TEST(testtdf99556);
CPPUNIT_TEST(testTdf103500);
CPPUNIT_TEST_SUITE_END();
private:
@@ -120,6 +122,13 @@ void Test::testtdf99556()
CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText());
}
void Test::testTdf103500()
{
loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/tdf103500.mml"));
CPPUNIT_ASSERT_EQUAL(OUString("{{ int csub a csup b {1 over x ` d x}} = {intd csub a csup b {1 over y ` d y}}}"),
mxDocShell->GetText());
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 3db53a9..fe84e55 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -2447,7 +2447,11 @@ void SmMathSymbolNode::Arrange(OutputDevice &rDev, const SmFormat &rFormat)
void SmMathSymbolNode::CreateTextFromNode(OUString &rText)
{
OUString sStr;
MathType::LookupChar(GetToken().cMathChar, sStr, 3);
sal_Unicode cChar = GetToken().cMathChar;
if (cChar == MS_INT && GetScaleMode() == SCALE_HEIGHT)
sStr = "intd ";
else
MathType::LookupChar(cChar, sStr, 3);
rText += sStr;
}