diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-08-16 00:11:56 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-08-16 00:14:26 +0200 |
commit | 0e633c51d8ed0c0d4050a3d0781c5bc036607616 (patch) | |
tree | 210df41ac8e66f71e5183f4e2792f6fb78dc7b0b /sc/qa | |
parent | 2cc0109c0a1a8ff9a6bdb1cd5fc38f0c3520585a (diff) |
add test for fdo#82128
Change-Id: I3dd0005f00c4a861103ffd1a0422b9fc9397f6fb
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/data/ods/sheet-protection.ods | bin | 0 -> 10547 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 33 |
2 files changed, 33 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/sheet-protection.ods b/sc/qa/unit/data/ods/sheet-protection.ods Binary files differnew file mode 100644 index 000000000000..8cfbbd28178e --- /dev/null +++ b/sc/qa/unit/data/ods/sheet-protection.ods diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 0be4d5e2f2d8..466ca6780bdf 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -116,6 +116,7 @@ public: #endif void testRelativePaths(); + void testSheetProtection(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -152,6 +153,7 @@ public: #if !defined(WNT) CPPUNIT_TEST(testRelativePaths); #endif + CPPUNIT_TEST(testSheetProtection); /* TODO: export to ODS currently (2014-04-28) makes the validator stumble, * probably due to a loext:fill-character attribute in a @@ -1932,6 +1934,37 @@ void ScExportTest::testRelativePaths() CPPUNIT_ASSERT(aURL.startsWith("..")); } +namespace { + +void testSheetProtection_Impl(ScDocument& rDoc) +{ + CPPUNIT_ASSERT(rDoc.IsTabProtected(0)); + + ScTableProtection* pTabProtection = rDoc.GetTabProtection(0); + CPPUNIT_ASSERT(pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS)); + CPPUNIT_ASSERT(!pTabProtection->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS)); +} + +} +void ScExportTest::testSheetProtection() +{ + ScDocShellRef xDocSh = loadDoc("sheet-protection.", ODS); + CPPUNIT_ASSERT(xDocSh.Is()); + + { + ScDocument& rDoc = xDocSh->GetDocument(); + testSheetProtection_Impl(rDoc); + } + + ScDocShellRef xDocSh2 = saveAndReload(xDocSh, ODS); + { + ScDocument& rDoc = xDocSh2->GetDocument(); + testSheetProtection_Impl(rDoc); + } + + xDocSh2->DoClose(); +} + #if 0 void ScExportTest::testFunctionsExcel2010ODS() { |