add test case for old password algorithm, related fdo#45171
This commit is contained in:
parent
84c8559820
commit
8f82bccf26
2 changed files with 22 additions and 5 deletions
BIN
sc/qa/unit/data/ods/passwordOld.ods
Normal file
BIN
sc/qa/unit/data/ods/passwordOld.ods
Normal file
Binary file not shown.
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue