diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-12-02 10:47:55 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-12-02 12:57:29 +0000 |
commit | 47d549c015d53b84b4f98c144c1b49378d027a4d (patch) | |
tree | 52b4372110e1db060c3c880e13a34a865e849345 /starmath | |
parent | 2b093d27b7e6f231512920f20089fcac291b021f (diff) |
tdf#151842: starmath_import: Add unittest
Change-Id: Iaae4880324872786f956d112a71c4f0870853f90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143568
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/inc/format.hxx | 3 | ||||
-rw-r--r-- | starmath/inc/utility.hxx | 3 | ||||
-rw-r--r-- | starmath/qa/extras/data/tdf151842.odf | bin | 0 -> 6073 bytes | |||
-rw-r--r-- | starmath/qa/extras/mmlimport-test.cxx | 16 |
4 files changed, 20 insertions, 2 deletions
diff --git a/starmath/inc/format.hxx b/starmath/inc/format.hxx index 61fc8b04764f..23dc04d290cf 100644 --- a/starmath/inc/format.hxx +++ b/starmath/inc/format.hxx @@ -19,6 +19,7 @@ #pragma once +#include "smdllapi.hxx" #include <svl/hint.hxx> #include <svl/SfxBroadcaster.hxx> #include "utility.hxx" @@ -87,7 +88,7 @@ enum class SmHorAlign { Right }; -class SmFormat final : public SfxBroadcaster +class SM_DLLPUBLIC SmFormat final : public SfxBroadcaster { SmFace vFont[FNT_END + 1]; bool bDefaultFont[FNT_END + 1]; diff --git a/starmath/inc/utility.hxx b/starmath/inc/utility.hxx index a05578a53647..83f3cc124dc1 100644 --- a/starmath/inc/utility.hxx +++ b/starmath/inc/utility.hxx @@ -20,6 +20,7 @@ #pragma once #include <sal/config.h> +#include "smdllapi.hxx" #include <comphelper/lok.hxx> #include <o3tl/unit_conversion.hxx> @@ -41,7 +42,7 @@ SmViewShell * SmGetActiveView(); bool IsItalic( const vcl::Font &rFont ); bool IsBold( const vcl::Font &rFont ); -class SmFace final : public vcl::Font +class SM_DLLPUBLIC SmFace final : public vcl::Font { tools::Long nBorderWidth; diff --git a/starmath/qa/extras/data/tdf151842.odf b/starmath/qa/extras/data/tdf151842.odf Binary files differnew file mode 100644 index 000000000000..cd8166dd9d93 --- /dev/null +++ b/starmath/qa/extras/data/tdf151842.odf diff --git a/starmath/qa/extras/mmlimport-test.cxx b/starmath/qa/extras/mmlimport-test.cxx index 323b0e0fb2d4..0f80f375acea 100644 --- a/starmath/qa/extras/mmlimport-test.cxx +++ b/starmath/qa/extras/mmlimport-test.cxx @@ -40,6 +40,7 @@ public: void testTdf103430(); void testTdf103500(); void testTdf137008(); + void testTdf151842(); void testMathmlEntities(); CPPUNIT_TEST_SUITE(Test); @@ -52,6 +53,7 @@ public: CPPUNIT_TEST(testTdf103430); CPPUNIT_TEST(testTdf103500); CPPUNIT_TEST(testTdf137008); + CPPUNIT_TEST(testTdf151842); CPPUNIT_TEST(testMathmlEntities); CPPUNIT_TEST_SUITE_END(); @@ -177,6 +179,20 @@ void Test::testTdf137008() loadURL(m_directories.getURLFromSrc(u"starmath/qa/extras/data/tdf137008.mml")); CPPUNIT_ASSERT_EQUAL(OUString("matrix{ { } # ## # }"), mxDocShell->GetText()); } + +void Test::testTdf151842() +{ + // Without the fix in place, this test would have crashed + loadURL(m_directories.getURLFromSrc(u"starmath/qa/extras/data/tdf151842.odf")); + CPPUNIT_ASSERT_EQUAL(OUString("test"), mxDocShell->GetText()); + SmFormat aFormat = mxDocShell->GetFormat(); + + // Without the fix in place, this test would have failed with + // - Expected: 4233 + // - Actual : 423 + CPPUNIT_ASSERT_EQUAL(tools::Long(4233), aFormat.GetBaseSize().Height()); +} + void Test::testMathmlEntities() { loadURL(m_directories.getURLFromSrc(u"starmath/qa/extras/data/mthmlentities.mml")); |