diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-02-21 09:30:26 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-02-21 15:19:19 +0100 |
commit | 8f82bccf26d14d3ad4a64739edd9ba23c124b8ad (patch) | |
tree | db94a9dab617df84a48dea048dee6024ab2c4d39 | |
parent | 84c8559820ba33c1ac4e7a8ce5412cf5534b954c (diff) |
add test case for old password algorithm, related fdo#45171
-rw-r--r-- | sc/qa/unit/data/ods/passwordOld.ods | bin | 0 -> 6447 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 27 |
2 files changed, 22 insertions, 5 deletions
diff --git a/sc/qa/unit/data/ods/passwordOld.ods b/sc/qa/unit/data/ods/passwordOld.ods Binary files differnew file mode 100644 index 000000000000..eee9ede03187 --- /dev/null +++ b/sc/qa/unit/data/ods/passwordOld.ods diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index af0b159f694a..f5f1eafd672a 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -106,7 +106,9 @@ public: void testBugFixesXLSX(); //misc tests unrelated to the import filters - void testPassword(); + void testPasswordNew(); + void testPasswordOld(); + CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testRangeNameXLS); @@ -124,7 +126,8 @@ public: //disable testPassword on MacOSX due to problems with libsqlite3 //also crashes on DragonFly due to problems with nss/nspr headers #if !defined(MACOSX) && !defined(DRAGONFLY) - CPPUNIT_TEST(testPassword); + CPPUNIT_TEST(testPasswordOld); + CPPUNIT_TEST(testPasswordNew); #endif #if TEST_BUG_FILES @@ -135,6 +138,7 @@ public: CPPUNIT_TEST_SUITE_END(); private: + void testPassword_Impl(const rtl::OUString& rFileNameBase); ScDocShellRef loadDoc(const rtl::OUString& rName, sal_Int32 nType); uno::Reference<uno::XInterface> m_xCalcComponent; @@ -520,15 +524,13 @@ void ScFiltersTest::testBugFixesXLSX() xDocSh->DoClose(); } -void ScFiltersTest::testPassword() +void ScFiltersTest::testPassword_Impl(const rtl::OUString& aFileNameBase) { - const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("password.")); rtl::OUString aFileExtension(aFileFormats[0].pName, strlen(aFileFormats[0].pName), RTL_TEXTENCODING_UTF8 ); rtl::OUString aFilterName(aFileFormats[0].pFilterName, strlen(aFileFormats[0].pFilterName), RTL_TEXTENCODING_UTF8) ; rtl::OUString aFileName; createFileURL(aFileNameBase, aFileExtension, aFileName); rtl::OUString aFilterType(aFileFormats[0].pTypeName, strlen(aFileFormats[0].pTypeName), RTL_TEXTENCODING_UTF8); - std::cout << aFileFormats[0].pName << " Test" << std::endl; sal_uInt32 nFormat = SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS; SfxFilter* aFilter = new SfxFilter( @@ -553,6 +555,21 @@ void ScFiltersTest::testPassword() ScDocument* pDoc = xDocSh->GetDocument(); CPPUNIT_ASSERT_MESSAGE("No Document", pDoc); //remove with first test xDocSh->DoClose(); + +} + +void ScFiltersTest::testPasswordNew() +{ + //tests opening a file with new password algorithm + const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("password.")); + testPassword_Impl(aFileNameBase); +} + +void ScFiltersTest::testPasswordOld() +{ + //tests opening a file with old password algorithm + const rtl::OUString aFileNameBase(RTL_CONSTASCII_USTRINGPARAM("passwordOld.")); + testPassword_Impl(aFileNameBase); } ScFiltersTest::ScFiltersTest() |