sc/qa/unit/data/xls/enhanced-protection.xls |binary sc/qa/unit/data/xlsx/enhanced-protection.xlsx |binary sc/qa/unit/filters-test.cxx | 30 +++++++++++++++++++++----- 3 files changed, 25 insertions(+), 5 deletions(-)
New commits: commit b0a6b164951c692cf5940d0c6e0c102603738f95 Author: Eike Rathke <er...@redhat.com> Date: Tue Apr 8 21:14:21 2014 +0200 add .xlsx unit test for enhanced protection Change-Id: I8a6c6295998c6545318f6b490d1f617d6178013b diff --git a/sc/qa/unit/data/xlsx/enhanced-protection.xlsx b/sc/qa/unit/data/xlsx/enhanced-protection.xlsx new file mode 100644 index 0000000..d9225a2 Binary files /dev/null and b/sc/qa/unit/data/xlsx/enhanced-protection.xlsx differ diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index 0072412..43692b5 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -71,6 +71,7 @@ public: void testSharedFormulaXLSX(); void testLegacyCellAnchoredRotatedShape(); void testEnhancedProtectionXLS(); + void testEnhancedProtectionXLSX(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testCVEs); @@ -85,6 +86,7 @@ public: CPPUNIT_TEST(testSharedFormulaXLSX); CPPUNIT_TEST(testLegacyCellAnchoredRotatedShape); CPPUNIT_TEST(testEnhancedProtectionXLS); + CPPUNIT_TEST(testEnhancedProtectionXLSX); CPPUNIT_TEST_SUITE_END(); @@ -499,12 +501,8 @@ void ScFiltersTest::testLegacyCellAnchoredRotatedShape() } } -void ScFiltersTest::testEnhancedProtectionXLS() +void testEnhancedProtectionImpl( ScDocument* pDoc ) { - 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 @@ -516,6 +514,26 @@ void ScFiltersTest::testEnhancedProtectionXLS() 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 +} + +void ScFiltersTest::testEnhancedProtectionXLS() +{ + ScDocShellRef xDocSh = loadDoc("enhanced-protection.", XLS); + CPPUNIT_ASSERT(xDocSh.Is()); + ScDocument* pDoc = xDocSh->GetDocument(); + + testEnhancedProtectionImpl( pDoc); + + xDocSh->DoClose(); +} + +void ScFiltersTest::testEnhancedProtectionXLSX() +{ + ScDocShellRef xDocSh = loadDoc("enhanced-protection.", XLSX); + CPPUNIT_ASSERT(xDocSh.Is()); + ScDocument* pDoc = xDocSh->GetDocument(); + + testEnhancedProtectionImpl( pDoc); xDocSh->DoClose(); } commit 6d658afd403d40071206f7e83cd7bd68d826a65b Author: Eike Rathke <er...@redhat.com> Date: Tue Apr 8 21:09:13 2014 +0200 add non-editable test for descriptor Change-Id: I0a40e9e26e09e970023a749b7fd0a67ac29d1bc1 diff --git a/sc/qa/unit/data/xls/enhanced-protection.xls b/sc/qa/unit/data/xls/enhanced-protection.xls index 00cc6e6..26e2327 100644 Binary files a/sc/qa/unit/data/xls/enhanced-protection.xls and b/sc/qa/unit/data/xls/enhanced-protection.xls differ diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index b6d7d76..0072412 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -511,6 +511,8 @@ void ScFiltersTest::testEnhancedProtectionXLS() 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, 4, 0, 0, 4, 0))); // editable with descriptor + CPPUNIT_ASSERT( !pProt->isBlockEditable( ScRange( 0, 5, 0, 0, 5, 0))); // editable with descriptor and 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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits