diff options
author | Jaskaran Singh <jvsg1303@gmail.com> | 2016-08-05 14:36:53 +0530 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-09-18 00:15:20 +0200 |
commit | 301e0dd1d223cea43390bc886c3ae39d6cadb5e5 (patch) | |
tree | 7e19e304fde71e0ac0cd015eff58dcfd61a71620 | |
parent | cc65cc7846758cc3aad987be5ab7b70d4c68f39a (diff) |
Add test for cell protection in orcus interface
Change-Id: I952b5897bf3f728d103c43d93cadeffb92d1c3a9
-rw-r--r-- | sc/qa/unit/data/xml/styles.xml | 9 | ||||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 40 |
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 8c1b490ae88d..d57cd6b9371a 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 |