From 8f82bccf26d14d3ad4a64739edd9ba23c124b8ad Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Tue, 21 Feb 2012 09:30:26 +0100 Subject: [PATCH] add test case for old password algorithm, related fdo#45171 --- sc/qa/unit/data/ods/passwordOld.ods | Bin 0 -> 6447 bytes sc/qa/unit/subsequent_filters-test.cxx | 27 ++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 sc/qa/unit/data/ods/passwordOld.ods diff --git a/sc/qa/unit/data/ods/passwordOld.ods b/sc/qa/unit/data/ods/passwordOld.ods new file mode 100644 index 0000000000000000000000000000000000000000..eee9ede031878e0ea3e49c7779d1dbe5eb42d84f GIT binary patch literal 6447 zcmb7I1yq#X)*iZBKtV>jOB#uxQRxOL2WCKeVCY7=kxmf_1!?IJDFx|n5RmR}`N4br z@P140|J^-nuXWbUJkPt=IqyDuKU-N23HcTPfDQnZa%qV9TMCA-0|0<)zxoPbWo8An zcY#5{Fqoy8G1%VB#+t*?8p3V^hMU3JZD3Gqh>fv>71Y|E9S*aDf+6r{P^i7~4^H%d zb6(N>Wj{Ef_F#5rE6W~ODpY->OO?J`5APV8wtE2(Kg29_`XG%dq0p^OUaOn9Fq~b1 zj=#0Rqlvz*E{8*HmbZSiU3^dmVY1>4h>kdLY@$2%yK(hXZY-jfJ@)+v^XML~#`V zzg0?7T~NSHktRNr)U`Q-E*}^%Zn!e)EMflr!yZmsb2^)y-OFC?{`d&}KFb;7NGpmj zuU^chHbmHpPu0 z63`$;5P2tcT#n(SL^$p%pH-R#sfij>!ZdRpC%(+AP-qYTq6mX7^AET5yd>KlHR^sYBJx{z8~4h_BebV|q#0RXu6KOY$O)zQJB z_V#Ahrts@S3)SYMy%<0=$YAyjRzt`UdL=j~RYtRAeZIO_J~?|QEJWcA0W^|9fMr3K zm~M%2lcnKF-ebg+e8kJMm;w_JXh^kyXdQrjU-6|mpAoCxBh}>nhgkX8^L;U4B{^&2 zzO+8(GjcRB59UR035KS#m=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mqM|FrBxm*Ru2r_G>D!t* z$vECVVn2y4+DdU(>Q6Nc0Ji57kS40A^}QFQ^JRqK=3uEMg|U_A>lvh`x_QqD5|*C! zx3##a*EuTCeJ%Uq{qgl#k1ztnK8=khKNw5%w|pYV;vV5m6OZ2BLp#&7=Z!yvW@pBn{Q4q} zI9MXLwPW&<7w=J&2Z(u_PmyKKwe(x8vK|0<(jKjj_Ha8Mkbqu8z5No!rpTfu$0;_F zNWK-bC#Q}l#aTdkulv)u|*G+;0*IY*VjlKZn!l9~2F zEHFpgNUV62SWKUW@eY67=L(vz+96H(-9>An0dw{cbu`<$=>>>rFlY^TEiEUmP>E~J zY-ZnRJV@%C39r=qlfbGVP5QLC*xc7L_2;MBibW>jxc7KuPil=orCpIge`LM9;9iN?VKTK0Naq&W`FHktF|xQ zZB~P)Q@I8~pVGv)wka2_m&g~VBMNKzWl`pq!R_wfIq&XIM0&{SvgsrGj$a~CL)7WD z_C#@em`hrVmSB>`F!#*oTWls>HsqPS%g2Xr_XG+qe6eiBHmn+8#s_?|t+N!lv5GEl zsND+G&Y0`GinR)Bj}`B3E)_K{-{pAD@TRF3;1@*u>CVX0k0+*tX1Psb4LxhOIwFqkl*JD&(&xayN!@72U7% zxxXWS6$jTs|HhWDZh~KA|4-nbw8IUs8{;1+iT~WI8!!NHttD;@>#G0!yDa%tS^QHT z$=~q&sxlCFUG2*+ws=K)qhoGx|0;67 gCh~QWyRkijKa@OWITY0Ezu{edwy&f$(+}ML0sMnf7ytkO literal 0 HcmV?d00001 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 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()