summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-03-16 14:13:25 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2023-03-16 15:51:58 +0000
commit8cf26e739797fdceddf5e805f02c63179d17b70e (patch)
treeecc0ebfeb3d151b9adad6aaa74ac987718eb4bad /starmath
parentf039fe0da31907a58a4c3b6717cf29caf2685101 (diff)
CppunitTest_starmath_export: move code to method
Change-Id: I460ffc51d82ff8b727813228e93a6e0c95c8569a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148993 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/qa/extras/mmlexport-test.cxx59
1 files changed, 27 insertions, 32 deletions
diff --git a/starmath/qa/extras/mmlexport-test.cxx b/starmath/qa/extras/mmlexport-test.cxx
index f74c0c76c851..262ed6907b83 100644
--- a/starmath/qa/extras/mmlexport-test.cxx
+++ b/starmath/qa/extras/mmlexport-test.cxx
@@ -48,6 +48,8 @@ public:
protected:
virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override;
+ void checkMathVariant(bool bCapital, bool bSmall);
+
private:
xmlDocUniquePtr exportAndParse();
@@ -107,44 +109,37 @@ void MathMLExportTest::testTdf97049()
CPPUNIT_ASSERT_EQUAL(u'\x222B', aContent[0]);
}
+void MathMLExportTest::checkMathVariant(bool bCapital, bool bSmall)
+{
+ mxDocShell->SetText("%GAMMA %iGAMMA {ital %GAMMA} {nitalic %iGAMMA} "
+ "%gamma %igamma {ital %gamma} {nitalic %igamma}");
+ xmlDocUniquePtr pDoc = exportAndParse();
+ if (bCapital)
+ 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 (bSmall)
+ 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("");
+}
+
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)
-
- CHECK_MATHVARIANT(false, true); // default mode 2
+ checkMathVariant(false, true); // default mode 2
mxDocShell->SetGreekCharStyle(1); // mode 1
- CHECK_MATHVARIANT(true, true);
+ checkMathVariant(true, true);
mxDocShell->SetGreekCharStyle(0); // mode 0
- CHECK_MATHVARIANT(false, false);
-
-#undef CHECK_MATHVARIANT
+ checkMathVariant(false, false);
}
CPPUNIT_TEST_SUITE_REGISTRATION(MathMLExportTest);