/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include #if !defined(MACOSX) && !defined(WNT) #include #include #include #include class Test : public SwModelTestBase { public: Test() : SwModelTestBase("/sw/qa/extras/htmlexport/data/", "HTML (StarWriter)"), m_eUnit(FUNIT_NONE) { } private: bool mustCalcLayoutOf(const char* filename) SAL_OVERRIDE { return OString(filename) != "fdo62336.docx"; } bool mustTestImportOf(const char* filename) const SAL_OVERRIDE { return OString(filename) != "fdo62336.docx"; } void preTest(const char* filename) SAL_OVERRIDE { if (OString(filename) == "charborder.odt" && SW_MOD()) { // FIXME if padding-top gets exported as inches, not cms, we get rounding errors. SwMasterUsrPref* pPref = const_cast(SW_MOD()->GetUsrPref(false)); m_eUnit = pPref->GetMetric(); pPref->SetMetric(FUNIT_CM); } } void postTest(const char* filename) SAL_OVERRIDE { if (OString(filename) == "charborder.odt" && SW_MOD()) { SwMasterUsrPref* pPref = const_cast(SW_MOD()->GetUsrPref(false)); pPref->SetMetric(m_eUnit); } } FieldUnit m_eUnit; }; #define DECLARE_HTMLEXPORT_TEST(TestName, filename) DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test) DECLARE_HTMLEXPORT_TEST(testFdo62336, "fdo62336.docx") { // The problem was essentially a crash during table export as docx/rtf/html // If either of no-calc-layout or no-test-import is enabled, the crash does not occur } DECLARE_HTMLEXPORT_TEST(testCharacterBorder, "charborder.odt") { uno::Reference xRun(getRun(getParagraph(1),1), uno::UNO_QUERY); // Different Border { CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x6666FF,12,12,12,3,37), getProperty(xRun,"CharTopBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0xFF9900,0,99,0,2,99), getProperty(xRun,"CharLeftBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0xFF0000,0,169,0,1,169), getProperty(xRun,"CharBottomBorder")); CPPUNIT_ASSERT_BORDER_EQUAL(table::BorderLine2(0x0000FF,0,169,0,0,169), getProperty(xRun,"CharRightBorder")); } // Different Padding { CPPUNIT_ASSERT_EQUAL(sal_Int32(450), getProperty(xRun,"CharTopBorderDistance")); CPPUNIT_ASSERT_EQUAL(sal_Int32(550), getProperty(xRun,"CharLeftBorderDistance")); CPPUNIT_ASSERT_EQUAL(sal_Int32(150), getProperty(xRun,"CharBottomBorderDistance")); CPPUNIT_ASSERT_EQUAL(sal_Int32(250), getProperty(xRun,"CharRightBorderDistance")); } // No shadow } #endif CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */