summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaskaran Singh <jvsg1303@gmail.com>2016-08-05 14:36:53 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-08-23 00:52:28 +0200
commite5e9ddfe0370c7a03172a529a6f671ba29ac8789 (patch)
treec2ce6b1fd8d6e5e19f5bcb75a483914c9f2893cb
parent550f2b0b139b5aa6717a4b4305e6878b958eb1fc (diff)
Add test for cell protection in orcus interface
Change-Id: I952b5897bf3f728d103c43d93cadeffb92d1c3a9
-rw-r--r--sc/qa/unit/data/xml/styles.xml9
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx40
2 files changed, 42 insertions, 7 deletions
diff --git a/sc/qa/unit/data/xml/styles.xml b/sc/qa/unit/data/xml/styles.xml
index 85c1e497dc1f..19eeff5169ff 100644
--- a/sc/qa/unit/data/xml/styles.xml
+++ b/sc/qa/unit/data/xml/styles.xml
@@ -6,16 +6,13 @@
<style:style style:name="Name2" style:family="table-cell" style:parent-style-name="Text">
<style:table-cell-properties fo:diagonal-bl-tr="1.74pt dashed #ffccee" fo:diagonal-tl-br="0.74pt dash-dot #120000" fo:border-left="none" fo:border-right="0.74pt dotted #ff0000"/>
</style:style>
- <style:style style:name="Name4" style:family="table-cell" style:parent-style-name="Text">
- <style:table-cell-properties fo:border-top="0.74pt double-border #000000" fo:border-bottom="none" fo:border-left="0.74pt solid #000000" fo:border-right="0.74pt dotted #000000"/>
- </style:style>
- <style:style style:name="Name5" style:family="table-cell" style:parent-style-name="Text">
+ <style:style style:name="Name3" style:family="table-cell" style:parent-style-name="Text">
<style:table-cell-properties style:cell-protect="hidden-and-protected" style:print-content="true"/>
</style:style>
- <style:style style:name="Name6" style:family="table-cell" style:parent-style-name="Text">
+ <style:style style:name="Name4" style:family="table-cell" style:parent-style-name="Text">
<style:table-cell-properties style:cell-protect="protected formula-hidden" style:print-content="false"/>
</style:style>
- <style:style style:name="Name7" style:family="table-cell" style:parent-style-name="Text">
+ <style:style style:name="Name5" style:family="table-cell" style:parent-style-name="Text">
<style:table-cell-properties style:cell-protect="none" style:print-content="true"/>
</style:style>
<style:style style:name="Name8" style:family="table-cell" style:parent-style-name="Text">
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index f59f07ce3897..42152459c952 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -65,6 +65,7 @@
#include "externalrefmgr.hxx"
#include <stlpool.hxx>
#include <config_orcus.h>
+#include <attrib.hxx>
#if ENABLE_ORCUS
#include <orcusfiltersimpl.hxx>
@@ -2709,7 +2710,7 @@ void ScFiltersTest::testOrcusODSStyleInterface()
ASSERT_DOUBLES_EQUAL_MESSAGE("Error with top width", 1, pBoxItem->GetTop()->GetWidth());
ASSERT_DOUBLES_EQUAL_MESSAGE("Error with bottom width", 1, pBoxItem->GetBottom()->GetWidth());
- CPPUNIT_ASSERT_MESSAGE("Style Name1 : Has Attribute border, but it shouldn't.",
+ CPPUNIT_ASSERT_MESSAGE("Style Name1 : Has Attribute Protection, but it shouldn't.",
!pStyleSheet->GetItemSet().HasItem(ATTR_PROTECTION, &pItem));
CPPUNIT_ASSERT_MESSAGE("Style Name1 : Has Attribute font, but it shouldn't.",
!pStyleSheet->GetItemSet().HasItem(ATTR_FONT, &pItem));
@@ -2754,6 +2755,43 @@ void ScFiltersTest::testOrcusODSStyleInterface()
!pStyleSheet->GetItemSet().HasItem(ATTR_FONT, &pItem));
CPPUNIT_ASSERT_MESSAGE("Style Name2 : Has Attribute number format, but it shouldn't.",
!pStyleSheet->GetItemSet().HasItem(ATTR_VALUE_FORMAT, &pItem));
+
+ /* Test for Style "Name3"
+ * Hidden, protected and content is printed.
+ */
+ pStyleSheet = pStyleSheetPool->FindCaseIns("Name3", SfxStyleFamily::Para);
+ CPPUNIT_ASSERT_MESSAGE("Style Name3 : Doesn't have Attribute Protection, but it should have.",
+ pStyleSheet->GetItemSet().HasItem(ATTR_PROTECTION, &pItem));
+
+ CPPUNIT_ASSERT_MESSAGE("Style Name 3 : Error with Protection attribute." ,ScProtectionAttr(true, false, true, true) == *pItem);
+
+ /* Test for Style "Name4"
+ * Hidden, protected and content is printed.
+ */
+ pStyleSheet = pStyleSheetPool->FindCaseIns("Name4", SfxStyleFamily::Para);
+ CPPUNIT_ASSERT_MESSAGE("Style Name4 : Doesn't have Attribute Protection, but it should have.",
+ pStyleSheet->GetItemSet().HasItem(ATTR_PROTECTION, &pItem));
+
+ CPPUNIT_ASSERT_MESSAGE("Style Name 4 : Error with Protection attribute." ,ScProtectionAttr(true, true, false, false) == *pItem);
+
+ /* Test for Style "Name3"
+ * Hidden, protected and content is printed.
+ */
+ pStyleSheet = pStyleSheetPool->FindCaseIns("Name5", SfxStyleFamily::Para);
+ CPPUNIT_ASSERT_MESSAGE("Style Name5 : Doesn't have Attribute Protection, but it should have.",
+ pStyleSheet->GetItemSet().HasItem(ATTR_PROTECTION, &pItem));
+
+ CPPUNIT_ASSERT_MESSAGE("Style Name 5 : Error with Protection attribute." ,ScProtectionAttr(false, false, false, true) == *pItem);
+
+ CPPUNIT_ASSERT_MESSAGE("Style Name5 : Has Attribute Border, but it shouldn't.",
+ !pStyleSheet->GetItemSet().HasItem(ATTR_BORDER, &pItem));
+ CPPUNIT_ASSERT_MESSAGE("Style Name5: Has Attribute background, but it shouldn't.",
+ !pStyleSheet->GetItemSet().HasItem(ATTR_BACKGROUND, &pItem));
+ CPPUNIT_ASSERT_MESSAGE("Style Name5 : Has Attribute font, but it shouldn't.",
+ !pStyleSheet->GetItemSet().HasItem(ATTR_FONT, &pItem));
+ CPPUNIT_ASSERT_MESSAGE("Style Name5 : Has Attribute number format, but it shouldn't.",
+ !pStyleSheet->GetItemSet().HasItem(ATTR_VALUE_FORMAT, &pItem));
+
}
#endif