diff options
author | Noel Power <noel.power@suse.com> | 2013-08-01 10:04:42 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-08-03 12:34:02 +0000 |
commit | 9d07f380bb0d5053571a9f3866b0415fe8339c5b (patch) | |
tree | 51003673f803c5e12d5976918229fccc36fb9dd5 /sc/qa | |
parent | c549ac677ba6279387aca33c5117b8ee1461bd9e (diff) |
1st step fix for exporting SheetProtection fdo#64753 is to import correctly
(cherry picked from commit 016e18680e471d9f0cea8ee35f9716ae0f9baa11)
2nd step to export SheetProtection fdo#64753, actually export the data
(cherry picked from commit 8ce1124359783df750d176b8390b4eb0f54fb6ba)
unit test for fdo#64753 ( import/export of sheetprotection )
Conflicts:
sc/qa/unit/subsequent_export-test.cxx
Change-Id: If420b386543c15c7b550a720b6e2db69bf372d7f
Reviewed-on: https://gerrit.libreoffice.org/5229
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/qa')
-rwxr-xr-x | sc/qa/unit/data/xlsx/ProtecteSheet1234Pass.xlsx | bin | 0 -> 7768 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 31 |
2 files changed, 31 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/ProtecteSheet1234Pass.xlsx b/sc/qa/unit/data/xlsx/ProtecteSheet1234Pass.xlsx Binary files differnew file mode 100755 index 000000000000..509ebe2322f2 --- /dev/null +++ b/sc/qa/unit/data/xlsx/ProtecteSheet1234Pass.xlsx diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index ed23eeedb566..9a06e9afd081 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -29,6 +29,7 @@ #include "scitems.hxx" #include "document.hxx" #include "cellform.hxx" +#include "tabprotection.hxx" using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -53,6 +54,7 @@ public: void testDataBarExportXLSX(); void testMiscRowHeightExport(); void testNamedRangeBugfdo62729(); + void testSheetProtectionXLSX(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -65,6 +67,7 @@ public: CPPUNIT_TEST(testColorScaleExportXLSX); CPPUNIT_TEST(testMiscRowHeightExport); CPPUNIT_TEST(testNamedRangeBugfdo62729); + CPPUNIT_TEST(testSheetProtectionXLSX); CPPUNIT_TEST_SUITE_END(); private: @@ -322,6 +325,34 @@ void ScExportTest::testNamedRangeBugfdo62729() xDocSh->DoClose(); } +void ScExportTest::testSheetProtectionXLSX() +{ + ScDocShellRef xShell = loadDoc("ProtecteSheet1234Pass.", XLSX); + CPPUNIT_ASSERT(xShell.Is()); + + ScDocShellRef xDocSh = saveAndReload(xShell, XLSX); + CPPUNIT_ASSERT(xDocSh.Is()); + + ScDocument* pDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(pDoc); + const ScTableProtection* pTabProtect = pDoc->GetTabProtection(0); + CPPUNIT_ASSERT(pTabProtect); + if ( pTabProtect ) + { + Sequence<sal_Int8> aHash = pTabProtect->getPasswordHash(PASSHASH_XL); + // check has + if (aHash.getLength() >= 2) + { + CPPUNIT_ASSERT( (sal_uInt8)aHash[0] == 204 ); + CPPUNIT_ASSERT( (sal_uInt8)aHash[1] == 61 ); + } + // we could flesh out this check I guess + CPPUNIT_ASSERT ( pTabProtect->isOptionEnabled( ScTableProtection::OBJECTS ) ); + CPPUNIT_ASSERT ( pTabProtect->isOptionEnabled( ScTableProtection::SCENARIOS ) ); + } + xDocSh->DoClose(); +} + ScExportTest::ScExportTest() : ScBootstrapFixture("/sc/qa/unit/data") { |