[Libreoffice-commits] .: sc/qa

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Tue Feb 21 06:23:08 PST 2012


 sc/qa/unit/data/ods/passwordOld.ods    |binary
 sc/qa/unit/subsequent_filters-test.cxx |   27 ++++++++++++++++++++++-----
 2 files changed, 22 insertions(+), 5 deletions(-)

New commits:
commit 8f82bccf26d14d3ad4a64739edd9ba23c124b8ad
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Feb 21 09:30:26 2012 +0100

    add test case for old password algorithm, related fdo#45171

diff --git a/sc/qa/unit/data/ods/passwordOld.ods b/sc/qa/unit/data/ods/passwordOld.ods
new file mode 100644
index 0000000..eee9ede
Binary files /dev/null and b/sc/qa/unit/data/ods/passwordOld.ods differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index af0b159..f5f1eaf 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()


More information about the Libreoffice-commits mailing list