summaryrefslogtreecommitdiff
path: root/starmath/qa
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2016-11-13 21:06:55 +0900
committerTakeshi Abe <tabe@fixedpoint.jp>2016-11-15 00:27:30 +0000
commit074f0ab1d76f16fe92493868e2f2de75e67792ef (patch)
tree75e27850211fc1d12618b795eaa2d6e853f1f711 /starmath/qa
parentbb50b1609abe83265311613db4a18e992dc666c8 (diff)
tdf#76296 Import MathML's <mspace>
as possibly multiple "~" and/or "`" by honoring its width attribute. Change-Id: I17e361c3f8f5d061c856b72266332369497d16b9 Reviewed-on: https://gerrit.libreoffice.org/30809 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
Diffstat (limited to 'starmath/qa')
-rw-r--r--starmath/qa/extras/data/mspace.mml12
-rw-r--r--starmath/qa/extras/mmlexport-test.cxx10
-rw-r--r--starmath/qa/extras/mmlimport-test.cxx8
3 files changed, 30 insertions, 0 deletions
diff --git a/starmath/qa/extras/data/mspace.mml b/starmath/qa/extras/data/mspace.mml
new file mode 100644
index 000000000000..1906510940ea
--- /dev/null
+++ b/starmath/qa/extras/data/mspace.mml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<math xmlns="http://www.w3.org/1998/Math/MathML">
+ <mrow>
+ <mi>a</mi>
+ <mspace />
+ <mi>b</mi>
+ <mspace width="2em" />
+ <mi>c</mi>
+ <mspace width="5.5em" />
+ <mi>d</mi>
+ </mrow>
+</math>
diff --git a/starmath/qa/extras/mmlexport-test.cxx b/starmath/qa/extras/mmlexport-test.cxx
index 1266ca0ec3e5..b63b22f9b48d 100644
--- a/starmath/qa/extras/mmlexport-test.cxx
+++ b/starmath/qa/extras/mmlexport-test.cxx
@@ -35,10 +35,12 @@ public:
virtual void setUp() override;
virtual void tearDown() override;
+ void testBlank();
void testTdf97049();
void testTdf101022();
CPPUNIT_TEST_SUITE(MathMLExportTest);
+ CPPUNIT_TEST(testBlank);
CPPUNIT_TEST(testTdf97049);
CPPUNIT_TEST(testTdf101022);
CPPUNIT_TEST_SUITE_END();
@@ -87,6 +89,14 @@ xmlDocPtr MathMLExportTest::exportAndParse()
return pDoc;
}
+void MathMLExportTest::testBlank()
+{
+ mxDocShell->SetText("x`y~~z");
+ xmlDocPtr pDoc = exportAndParse();
+ assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mspace[1]", "width", "0.5em");
+ assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mspace[2]", "width", "4em");
+}
+
void MathMLExportTest::testTdf97049()
{
mxDocShell->SetText("intd {{1 over x} dx}");
diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx
index 5ca5d70e8012..9bbc08ae39a9 100644
--- a/starmath/qa/extras/mmlimport-test.cxx
+++ b/starmath/qa/extras/mmlimport-test.cxx
@@ -32,12 +32,14 @@ public:
void testSimple();
void testNsPrefixMath();
void testMaction();
+ void testMspace();
void testtdf99556();
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testSimple);
CPPUNIT_TEST(testNsPrefixMath);
CPPUNIT_TEST(testMaction);
+ CPPUNIT_TEST(testMspace);
CPPUNIT_TEST(testtdf99556);
CPPUNIT_TEST_SUITE_END();
@@ -105,6 +107,12 @@ void Test::testMaction()
CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", sExpected, mxDocShell->GetText());
}
+void Test::testMspace()
+{
+ loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/mspace.mml"));
+ CPPUNIT_ASSERT_EQUAL(OUString("{a b ~ c ~~``` d}"), mxDocShell->GetText());
+}
+
void Test::testtdf99556()
{
loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/tdf99556-1.mml"));