diff options
author | Sarper Akdemir <sarper.akdemir@collabora.com> | 2022-10-24 01:50:36 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2022-10-27 15:13:32 +0200 |
commit | 08d0c2cd6b6bdf37d6fc5c16359bafc6dddc9d09 (patch) | |
tree | dc953fe8526e343272322ee7d66b2f94bf28f8ec /sd/qa/unit | |
parent | eeaac9cfdea6d8660ac72e63df3c9a1b8623db7c (diff) |
tdf#149961 pptx import: fix indents for autofitted texboxes
For autofitted textboxes, Impress scales the indents with the
text size while PowerPoint doesn't.
Scale the indents inversely propotional to autofit font
scale so that the visual appearance on import is similar to
PowerPoint.
Change-Id: I7876b35a1f4221789564fcf23ccbe3fe21db3d48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141717
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sd/qa/unit')
-rw-r--r-- | sd/qa/unit/data/pptx/tdf149961-autofitIndentation.pptx | bin | 0 -> 34123 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests2.cxx | 40 |
2 files changed, 40 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tdf149961-autofitIndentation.pptx b/sd/qa/unit/data/pptx/tdf149961-autofitIndentation.pptx Binary files differnew file mode 100644 index 000000000000..25513df7c9e8 --- /dev/null +++ b/sd/qa/unit/data/pptx/tdf149961-autofitIndentation.pptx diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index b95f2e3197e6..86641bde50ac 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -143,6 +143,7 @@ public: void testTdf144092TableHeight(); void testTdf89928BlackWhiteThreshold(); void testTdf151547TransparentWhiteText(); + void testTdf149961AutofitIndentation(); CPPUNIT_TEST_SUITE(SdImportTest2); @@ -219,6 +220,7 @@ public: CPPUNIT_TEST(testTdf144092TableHeight); CPPUNIT_TEST(testTdf89928BlackWhiteThreshold); CPPUNIT_TEST(testTdf151547TransparentWhiteText); + CPPUNIT_TEST(testTdf149961AutofitIndentation); CPPUNIT_TEST_SUITE_END(); }; @@ -2189,6 +2191,44 @@ void SdImportTest2::testTdf151547TransparentWhiteText() xDocShRef->DoClose(); } +void SdImportTest2::testTdf149961AutofitIndentation() +{ + sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf149961-autofitIndentation.pptx"), + PPTX); + + const SdrPage* pPage = GetPage(1, xDocShRef); + + { + SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(0)); + CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr); + + const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); + const SvxNumBulletItem* pNumFmt = aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET); + CPPUNIT_ASSERT(pNumFmt); + + CPPUNIT_ASSERT_EQUAL(sal_Int32(3175), pNumFmt->GetNumRule().GetLevel(0).GetAbsLSpace()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-3175), + pNumFmt->GetNumRule().GetLevel(0).GetFirstLineOffset()); + } + + { + SdrTextObj* pTxtObj = dynamic_cast<SdrTextObj*>(pPage->GetObj(1)); + CPPUNIT_ASSERT_MESSAGE("no text object", pTxtObj != nullptr); + + const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject(); + const SvxNumBulletItem* pNumFmt = aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET); + CPPUNIT_ASSERT(pNumFmt); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 12700 + // - Actual : 3175 + CPPUNIT_ASSERT_EQUAL(sal_Int32(12700), pNumFmt->GetNumRule().GetLevel(0).GetAbsLSpace()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(-12700), + pNumFmt->GetNumRule().GetLevel(0).GetFirstLineOffset()); + } +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); |