diff options
author | Eike Rathke <erack@redhat.com> | 2014-03-25 20:41:52 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2014-03-25 20:43:07 +0100 |
commit | e27cc864be4d18d5bf307c58ebf1c1aa4ef90078 (patch) | |
tree | f78fa7e2e71be20cfea322a2337a996f44425540 /sc/qa | |
parent | 98c6b4149e46eec6aaee5b64f2fa40678589dd4b (diff) |
added unit test for .xls BIFF enhanced protection
Change-Id: I8f218f8f8ce12525b4c9995567d2864baa610c0b
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/data/xls/enhanced-protection.xls | bin | 0 -> 25600 bytes | |||
-rw-r--r-- | sc/qa/unit/filters-test.cxx | 20 |
2 files changed, 20 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xls/enhanced-protection.xls b/sc/qa/unit/data/xls/enhanced-protection.xls Binary files differnew file mode 100644 index 000000000000..00cc6e6a3248 --- /dev/null +++ b/sc/qa/unit/data/xls/enhanced-protection.xls diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 4de62d1ec2ab..9d049f7e87de 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -31,6 +31,7 @@ #include "drwlayer.hxx" #include "userdat.hxx" #include "formulacell.hxx" +#include "tabprotection.hxx" #include <svx/svdpage.hxx> @@ -69,6 +70,7 @@ public: void testSharedFormulaXLS(); void testSharedFormulaXLSX(); void testLegacyCellAnchoredRotatedShape(); + void testEnhancedProtectionXLS(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testCVEs); @@ -82,6 +84,7 @@ public: CPPUNIT_TEST(testSharedFormulaXLS); CPPUNIT_TEST(testSharedFormulaXLSX); CPPUNIT_TEST(testLegacyCellAnchoredRotatedShape); + CPPUNIT_TEST(testEnhancedProtectionXLS); CPPUNIT_TEST_SUITE_END(); @@ -491,6 +494,23 @@ void ScFiltersTest::testLegacyCellAnchoredRotatedShape() } } +void ScFiltersTest::testEnhancedProtectionXLS() +{ + ScDocShellRef xDocSh = loadDoc("enhanced-protection.", XLS); + CPPUNIT_ASSERT(xDocSh.Is()); + ScDocument* pDoc = xDocSh->GetDocument(); + + const ScTableProtection* pProt = pDoc->GetTabProtection(0); + + CPPUNIT_ASSERT( !pProt->isBlockEditable( ScRange( 0, 0, 0, 0, 0, 0))); // locked + CPPUNIT_ASSERT( pProt->isBlockEditable( ScRange( 0, 1, 0, 0, 1, 0))); // editable without password + CPPUNIT_ASSERT( pProt->isBlockEditable( ScRange( 0, 2, 0, 0, 2, 0))); // editable without password + CPPUNIT_ASSERT( !pProt->isBlockEditable( ScRange( 0, 3, 0, 0, 3, 0))); // editable with password "foo" + CPPUNIT_ASSERT( pProt->isBlockEditable( ScRange( 0, 1, 0, 0, 2, 0))); // union of two different editables + CPPUNIT_ASSERT( !pProt->isBlockEditable( ScRange( 0, 0, 0, 0, 1, 0))); // union of locked and editable + CPPUNIT_ASSERT( !pProt->isBlockEditable( ScRange( 0, 2, 0, 0, 3, 0))); // union of editable and password editable +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "/sc/qa/unit/data" ) { |