diff options
-rw-r--r-- | solenv/clang-format/excludelist | 2 | ||||
-rw-r--r-- | starmath/qa/extras/data/color.mml | 4 | ||||
-rw-r--r-- | starmath/qa/extras/mmlexport-test.cxx | 63 | ||||
-rw-r--r-- | starmath/qa/extras/mmlimport-test.cxx | 55 |
4 files changed, 67 insertions, 57 deletions
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index b89112be0c23..fe0f19376b32 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -11118,8 +11118,6 @@ starmath/qa/cppunit/mock-visitor.hxx starmath/qa/cppunit/test_node.cxx starmath/qa/cppunit/test_parse.cxx starmath/qa/cppunit/test_starmath.cxx -starmath/qa/extras/mmlexport-test.cxx -starmath/qa/extras/mmlimport-test.cxx starmath/source/ElementsDockingWindow.cxx starmath/source/accessibility.cxx starmath/source/accessibility.hxx diff --git a/starmath/qa/extras/data/color.mml b/starmath/qa/extras/data/color.mml index 6aad87b21a7f..41294eff8311 100644 --- a/starmath/qa/extras/data/color.mml +++ b/starmath/qa/extras/data/color.mml @@ -16,5 +16,9 @@ <mi mathcolor="teal">t</mi> <mi mathcolor="aqua">a</mi> <mi mathcolor="fuchsia">f</mi> + <mi mathcolor="#DC143C">c</mi> + <mi mathcolor="#FFB781">a</mi> + <mi mathcolor="#FF0">y</mi> + <mi mathcolor="#DC143D">x</mi> </mrow> </math> diff --git a/starmath/qa/extras/mmlexport-test.cxx b/starmath/qa/extras/mmlexport-test.cxx index 18732e09abb1..d41ba41e6c69 100644 --- a/starmath/qa/extras/mmlexport-test.cxx +++ b/starmath/qa/extras/mmlexport-test.cxx @@ -23,8 +23,8 @@ #include <memory> -namespace { - +namespace +{ using namespace ::com::sun::star; typedef tools::SvRef<SmDocShell> SmDocShellRef; @@ -46,7 +46,7 @@ public: CPPUNIT_TEST_SUITE_END(); protected: - virtual void registerNamespaces(xmlXPathContextPtr &pXmlXPathCtx) override; + virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override; private: xmlDocUniquePtr exportAndParse(); @@ -58,9 +58,9 @@ void MathMLExportTest::setUp() { BootstrapFixture::setUp(); SmGlobals::ensure(); - mxDocShell = new SmDocShell(SfxModelFlags::EMBEDDED_OBJECT | - SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | - SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); + mxDocShell + = new SmDocShell(SfxModelFlags::EMBEDDED_OBJECT | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS + | SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); } void MathMLExportTest::tearDown() @@ -70,7 +70,7 @@ void MathMLExportTest::tearDown() BootstrapFixture::tearDown(); } -void MathMLExportTest::registerNamespaces(xmlXPathContextPtr &pXmlXPathCtx) +void MathMLExportTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) { xmlXPathRegisterNs(pXmlXPathCtx, BAD_CAST("m"), BAD_CAST("http://www.w3.org/1998/Math/MathML")); } @@ -109,28 +109,32 @@ void MathMLExportTest::testTdf97049() void MathMLExportTest::testTdf101022() { -#define CHECK_MATHVARIANT(capital, small) do \ - { \ - mxDocShell->SetText("%GAMMA %iGAMMA {ital %GAMMA} {nitalic %iGAMMA} " \ - "%gamma %igamma {ital %gamma} {nitalic %igamma}"); \ - xmlDocUniquePtr pDoc = exportAndParse(); \ - if (capital) \ - assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mi[1]", "mathvariant"); \ - else \ - assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mi[1]", "mathvariant", "normal"); \ - assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mstyle[1]/m:mi[1]", "mathvariant"); \ - assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mi[2]", "mathvariant"); \ - assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mstyle[2]/m:mi[1]", "mathvariant", "normal"); \ - if (small) \ - assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mi[3]", "mathvariant"); \ - else \ - assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mi[3]", "mathvariant", "normal"); \ - assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mstyle[3]/m:mi[1]", "mathvariant"); \ - assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mi[4]", "mathvariant"); \ - assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mstyle[4]/m:mi[1]", "mathvariant", "normal"); \ - mxDocShell->SetText(""); \ - } \ - while (false) +#define CHECK_MATHVARIANT(capital, small) \ + do \ + { \ + mxDocShell->SetText("%GAMMA %iGAMMA {ital %GAMMA} {nitalic %iGAMMA} " \ + "%gamma %igamma {ital %gamma} {nitalic %igamma}"); \ + xmlDocUniquePtr pDoc = exportAndParse(); \ + if (capital) \ + assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mi[1]", "mathvariant"); \ + else \ + assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mi[1]", "mathvariant", "normal"); \ + assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mstyle[1]/m:mi[1]", \ + "mathvariant"); \ + assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mi[2]", "mathvariant"); \ + assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mstyle[2]/m:mi[1]", "mathvariant", \ + "normal"); \ + if (small) \ + assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mi[3]", "mathvariant"); \ + else \ + assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mi[3]", "mathvariant", "normal"); \ + assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mstyle[3]/m:mi[1]", \ + "mathvariant"); \ + assertXPathNoAttribute(pDoc, "/m:math/m:semantics/m:mrow/m:mi[4]", "mathvariant"); \ + assertXPath(pDoc, "/m:math/m:semantics/m:mrow/m:mstyle[4]/m:mi[1]", "mathvariant", \ + "normal"); \ + mxDocShell->SetText(""); \ + } while (false) CHECK_MATHVARIANT(false, true); // default mode 2 @@ -144,7 +148,6 @@ void MathMLExportTest::testTdf101022() } CPPUNIT_TEST_SUITE_REGISTRATION(MathMLExportTest); - } CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx index b31fd1676102..3ae2c4f49ae8 100644 --- a/starmath/qa/extras/mmlimport-test.cxx +++ b/starmath/qa/extras/mmlimport-test.cxx @@ -19,8 +19,8 @@ #include <document.hxx> #include <smdll.hxx> -namespace { - +namespace +{ using namespace ::com::sun::star; typedef tools::SvRef<SmDocShell> SmDocShellRef; @@ -52,30 +52,27 @@ public: CPPUNIT_TEST_SUITE_END(); private: - void loadURL(const OUString &rURL) + void loadURL(const OUString& rURL) { // Cf. // filter/source/config/fragments/filters/MathML_XML__Math_.xcu - auto pFilter = std::make_shared<SfxFilter>(MATHML_XML, - OUString(), - SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::TEMPLATE, - SotClipboardFormatId::STARCALC_8, - "MathML 2.0", - OUString(), - OUString(), - "private:factory/smath*"); + auto pFilter = std::make_shared<SfxFilter>( + MATHML_XML, OUString(), + SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::TEMPLATE, + SotClipboardFormatId::STARCALC_8, "MathML 2.0", OUString(), OUString(), + "private:factory/smath*"); pFilter->SetVersion(SOFFICE_FILEFORMAT_60); - mxDocShell = new SmDocShell(SfxModelFlags::EMBEDDED_OBJECT | - SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS | - SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); + mxDocShell = new SmDocShell(SfxModelFlags::EMBEDDED_OBJECT + | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS + | SfxModelFlags::DISABLE_DOCUMENT_RECOVERY); SfxMedium* pSrcMed = new SfxMedium(rURL, StreamMode::STD_READ); pSrcMed->SetFilter(pFilter); pSrcMed->UseInteractionHandler(false); bool bLoaded = mxDocShell->DoLoad(pSrcMed); - CPPUNIT_ASSERT_MESSAGE(OUStringToOString("failed to load " + rURL, RTL_TEXTENCODING_UTF8).getStr(), - bLoaded); + CPPUNIT_ASSERT_MESSAGE( + OUStringToOString("failed to load " + rURL, RTL_TEXTENCODING_UTF8).getStr(), bLoaded); } SmDocShellRef mxDocShell; @@ -89,7 +86,8 @@ void Test::setUp() void Test::tearDown() { - if (mxDocShell.is()) mxDocShell->DoClose(); + if (mxDocShell.is()) + mxDocShell->DoClose(); BootstrapFixture::tearDown(); } @@ -111,26 +109,33 @@ void Test::testColor() " color navy n" " color teal t" " color aqua a" - " color fuchsia f }"), + " color fuchsia f" + " color crimson c" + " color dvip apricot" + " a color yellow y" + " color rgb 220 20 61 x }"), mxDocShell->GetText()); } void Test::testSimple() { loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/simple.mml")); - CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", OUString("left ( { a + b } right ) ^ 2"), mxDocShell->GetText()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", OUString("left ( { a + b } right ) ^ 2"), + mxDocShell->GetText()); } void Test::testNsPrefixMath() { loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/ns-prefix-math.mml")); - CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", OUString("left ( { a + b } right ) ^ 2"), mxDocShell->GetText()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", OUString("left ( { a + b } right ) ^ 2"), + mxDocShell->GetText()); } void Test::testMaction() { loadURL(m_directories.getURLFromSrc("starmath/qa/extras/data/maction.mml")); - CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", OUString("matrix{ 1 ## 2 ## 3 }"), mxDocShell->GetText()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("loaded text", OUString("matrix{ 1 ## 2 ## 3 }"), + mxDocShell->GetText()); } void Test::testMspace() @@ -148,20 +153,20 @@ void Test::testtdf99556() void Test::testTdf103430() { loadURL(m_directories.getURLFromSrc("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 } }"), + 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("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 } } }"), + 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_TEST_SUITE_REGISTRATION(Test); - } CPPUNIT_PLUGIN_IMPLEMENT(); |