summaryrefslogtreecommitdiff
path: root/sd/qa
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-08-29 19:09:29 +0200
committerDavid Tardon <dtardon@redhat.com>2014-09-02 06:09:06 -0500
commit5ef1742e7d4b6852331bca4d65ee568980fb233c (patch)
tree1e0c8753c587e62fccd6cd3b02c57cb48141bfdb /sd/qa
parent8718bcc3d74e5eed7499ec1359aff10659faaebc (diff)
n#708518: sd: check that master page matches when setting parent style
In ODF import it happened that the parent style of "outline2" etc. was always set to the "outline1" style of the first master page in the document, but it should be the "outline1" style of the same master page as the "outline2". (regression from e955433c3574cb602dedba96bc645898f97858bf) (cherry picked from commit 5b63c12ace2aec9a659e4b9125f6aa9ff204ed09) Conflicts: sd/qa/unit/import-tests.cxx Change-Id: Ie563d5ee5c2040aeb6ca5c8bb25b195e15ea964e Reviewed-on: https://gerrit.libreoffice.org/11195 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'sd/qa')
-rw-r--r--sd/qa/unit/data/odp/masterpage_style_parent.odpbin0 -> 17790 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx43
2 files changed, 43 insertions, 0 deletions
diff --git a/sd/qa/unit/data/odp/masterpage_style_parent.odp b/sd/qa/unit/data/odp/masterpage_style_parent.odp
new file mode 100644
index 000000000000..e9f63784905e
--- /dev/null
+++ b/sd/qa/unit/data/odp/masterpage_style_parent.odp
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index d6a9cfd1d207..a475566f3976 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -51,6 +51,8 @@
#include <config_features.h>
+#include <stlpool.hxx>
+
using namespace ::com::sun::star;
/// Impress import filters tests.
@@ -61,6 +63,7 @@ public:
void testSmoketest();
void testN759180();
void testN778859();
+ void testMasterPageStyleParent();
void testFdo64512();
void testFdo71075();
void testN828390();
@@ -90,6 +93,7 @@ public:
CPPUNIT_TEST(testSmoketest);
CPPUNIT_TEST(testN759180);
CPPUNIT_TEST(testN778859);
+ CPPUNIT_TEST(testMasterPageStyleParent);
CPPUNIT_TEST(testFdo64512);
CPPUNIT_TEST(testFdo71075);
CPPUNIT_TEST(testN828390);
@@ -488,6 +492,45 @@ void SdFiltersTest::testN828390_5()
xDocShRef->DoClose();
}
+void SdFiltersTest::testMasterPageStyleParent()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/odp/masterpage_style_parent.odp"));
+
+ SdDrawDocument *pDoc = xDocShRef->GetDoc();
+ CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
+ const SdrPage *pPage = pDoc->GetPage(1);
+ CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
+
+ SdStyleSheetPool *const pPool(pDoc->GetSdStyleSheetPool());
+
+ int parents(0);
+ SfxStyleSheetIterator iter(pPool, SD_STYLE_FAMILY_MASTERPAGE);
+ for (SfxStyleSheetBase * pStyle = iter.First(); pStyle; pStyle = iter.Next())
+ {
+ OUString const name(pStyle->GetName());
+ OUString const parent(pStyle->GetParent());
+ if (!parent.isEmpty())
+ {
+ ++parents;
+ // check that parent exists
+ SfxStyleSheetBase *const pParentStyle(
+ pPool->Find(parent, SD_STYLE_FAMILY_MASTERPAGE));
+ CPPUNIT_ASSERT(pParentStyle);
+ CPPUNIT_ASSERT_EQUAL(pParentStyle->GetName(), parent);
+ // check that parent has the same master page as pStyle
+ CPPUNIT_ASSERT(parent.indexOf(SD_LT_SEPARATOR) != -1);
+ CPPUNIT_ASSERT(name.indexOf(SD_LT_SEPARATOR) != -1);
+ CPPUNIT_ASSERT_EQUAL(
+ parent.copy(0, parent.indexOf(SD_LT_SEPARATOR)),
+ name.copy(0, name.indexOf(SD_LT_SEPARATOR)));
+ }
+ }
+ // check that there are actually parents...
+ CPPUNIT_ASSERT_EQUAL(16, parents);
+
+ xDocShRef->DoClose();
+}
+
void SdFiltersTest::testN778859()
{
::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/n778859.pptx"));