sw: reduce usage of DECLARE_SW_ROUNDTRIP_TEST

Change-Id: Ib2884a766ff891aa768530e62cb2825402b84d03
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175026
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Xisco Fauli 2024-10-16 16:38:19 +02:00
parent 302a0de82e
commit a79acaf274
4 changed files with 57 additions and 22 deletions

View file

@ -493,14 +493,30 @@ CPPUNIT_TEST_FIXTURE(Test, testFramebackgrounds)
assertXPath(pXmlDoc, "//style:style[@style:parent-style-name='Frame' and @style:family='graphic']/style:graphic-properties[@draw:fill='bitmap' and @fo:background-color='transparent' and @draw:opacity-name='Transparency_20_1']/style:background-image[@style:repeat='stretch' and @draw:opacity='43%']", 1);
}
DECLARE_SW_ROUNDTRIP_TEST(testSHA1Correct, "sha1_correct.odt", "1012345678901234567890123456789012345678901234567890", Test)
CPPUNIT_TEST_FIXTURE(Test, testSHA1Correct)
{ // tdf#114939 this has both an affected password as well as content.xml
const char* const sPass = "1012345678901234567890123456789012345678901234567890";
createSwDoc("sha1_correct.odt", sPass);
CPPUNIT_ASSERT_EQUAL(1, getPages());
getParagraph(1, u"012"_ustr);
saveAndReload(mpFilter, sPass);
CPPUNIT_ASSERT_EQUAL(1, getPages());
getParagraph(1, u"012"_ustr);
}
DECLARE_SW_ROUNDTRIP_TEST(testSHA1Wrong, "sha1_wrong.odt", "1012345678901234567890123456789012345678901234567890", Test)
CPPUNIT_TEST_FIXTURE(Test, testSHA1Wrong)
{ // tdf#114939 this has both an affected password as well as content.xml
const char* const sPass = "1012345678901234567890123456789012345678901234567890";
createSwDoc("sha1_wrong.odt", sPass);
CPPUNIT_ASSERT_EQUAL(1, getPages());
getParagraph(1, u"012"_ustr);
saveAndReload(mpFilter, sPass);
CPPUNIT_ASSERT_EQUAL(1, getPages());
getParagraph(1, u"012"_ustr);
}

View file

@ -21,8 +21,8 @@ public:
}
};
DECLARE_SW_ROUNDTRIP_TEST(testThemePortionLevelCharColor_ODF,
"Test_ThemePortionLevel_CharColor.fodt", nullptr, Test)
DECLARE_OOXMLEXPORT_TEST(testThemePortionLevelCharColor_ODF,
"Test_ThemePortionLevel_CharColor.fodt")
{
auto xParagraph = getParagraph(1);
CPPUNIT_ASSERT(xParagraph.is());
@ -36,8 +36,8 @@ DECLARE_SW_ROUNDTRIP_TEST(testThemePortionLevelCharColor_ODF,
CPPUNIT_ASSERT_EQUAL(sal_Int16(4000), rTransforms[0].mnValue);
}
DECLARE_SW_ROUNDTRIP_TEST(testThemePortionLevelCharColor_DOCX,
"Test_ThemePortionLevel_CharColor.docx", nullptr, Test)
DECLARE_OOXMLEXPORT_TEST(testThemePortionLevelCharColor_DOCX,
"Test_ThemePortionLevel_CharColor.docx")
{
auto xParagraph = getParagraph(1);
CPPUNIT_ASSERT(xParagraph.is());
@ -51,8 +51,7 @@ DECLARE_SW_ROUNDTRIP_TEST(testThemePortionLevelCharColor_DOCX,
CPPUNIT_ASSERT_EQUAL(sal_Int16(4000), rTransforms[0].mnValue);
}
DECLARE_SW_ROUNDTRIP_TEST(testThemePortionBorderColor_DOCX, "Test_ThemeBorderColor.docx", nullptr,
Test)
DECLARE_OOXMLEXPORT_TEST(testThemePortionBorderColor_DOCX, "Test_ThemeBorderColor.docx")
{
auto xParagraph = getParagraph(1);
CPPUNIT_ASSERT(xParagraph.is());
@ -81,8 +80,7 @@ DECLARE_SW_ROUNDTRIP_TEST(testThemePortionBorderColor_DOCX, "Test_ThemeBorderCol
CPPUNIT_ASSERT(isPropertyVoid(xParagraph, u"RightBorderComplexColor"_ustr));
}
DECLARE_SW_ROUNDTRIP_TEST(testCharUnderlineTheme_DOCX, "Test_CharUnderlineThemeColor.docx", nullptr,
Test)
DECLARE_OOXMLEXPORT_TEST(testCharUnderlineTheme_DOCX, "Test_CharUnderlineThemeColor.docx")
{
auto xParagraph = getParagraph(1);
CPPUNIT_ASSERT(xParagraph.is());
@ -97,8 +95,7 @@ DECLARE_SW_ROUNDTRIP_TEST(testCharUnderlineTheme_DOCX, "Test_CharUnderlineThemeC
CPPUNIT_ASSERT_EQUAL(sal_Int16(2509), rTransforms[0].mnValue);
}
DECLARE_SW_ROUNDTRIP_TEST(testParaBackgroundTheme_DOCX, "Test_ThemeTextParaBackgroundColor.docx",
nullptr, Test)
DECLARE_OOXMLEXPORT_TEST(testParaBackgroundTheme_DOCX, "Test_ThemeTextParaBackgroundColor.docx")
{
{
auto xParagraph = getParagraph(1);

View file

@ -19,32 +19,47 @@ public:
}
};
DECLARE_SW_ROUNDTRIP_TEST(testPasswordMSO2007, "Encrypted_MSO2007_abc.docx", "abc", Test)
CPPUNIT_TEST_FIXTURE(Test, testPasswordMSO2007)
{
const char* const sPass = "abc";
createSwDoc("Encrypted_MSO2007_abc.docx", sPass);
// Standard encryption format, AES 128, SHA1
uno::Reference<text::XTextRange> xParagraph(getParagraph(1));
CPPUNIT_ASSERT_EQUAL(u"abc"_ustr, xParagraph->getString());
CPPUNIT_ASSERT_EQUAL(u"abc"_ustr, getParagraph(1)->getString());
saveAndReload(mpFilter, sPass);
CPPUNIT_ASSERT_EQUAL(u"abc"_ustr, getParagraph(1)->getString());
}
DECLARE_SW_ROUNDTRIP_TEST(testPasswordMSO2010, "Encrypted_MSO2010_abc.docx", "abc", Test)
CPPUNIT_TEST_FIXTURE(Test, testPasswordMSO2010)
{
const char* const sPass = "abc";
createSwDoc("Encrypted_MSO2010_abc.docx", sPass);
// Agile encryption format, AES 128, CBC, SHA1
uno::Reference<text::XTextRange> xParagraph(getParagraph(1));
CPPUNIT_ASSERT_EQUAL(u"abc"_ustr, xParagraph->getString());
CPPUNIT_ASSERT_EQUAL(u"abc"_ustr, getParagraph(1)->getString());
saveAndReload(mpFilter, sPass);
CPPUNIT_ASSERT_EQUAL(u"abc"_ustr, getParagraph(1)->getString());
}
DECLARE_SW_ROUNDTRIP_TEST(testPasswordMSO2013, "Encrypted_MSO2013_abc.docx", "abc", Test)
CPPUNIT_TEST_FIXTURE(Test, testPasswordMSO2013)
{
const char* const sPass = "abc";
createSwDoc("Encrypted_MSO2013_abc.docx", sPass);
// Agile encryption format, AES 256, CBC, SHA512
uno::Reference<text::XTextRange> xParagraph(getParagraph(1));
CPPUNIT_ASSERT_EQUAL(u"ABC"_ustr, xParagraph->getString());
CPPUNIT_ASSERT_EQUAL(u"ABC"_ustr, getParagraph(1)->getString());
saveAndReload(mpFilter, sPass);
CPPUNIT_ASSERT_EQUAL(u"ABC"_ustr, getParagraph(1)->getString());
}
DECLARE_SW_ROUNDTRIP_TEST(testPasswordLOStandard, "Encrypted_LO_Standard_abc.docx", "abc", Test)
CPPUNIT_TEST_FIXTURE(Test, testPasswordLOStandard)
{
const char* const sPass = "abc";
createSwDoc("Encrypted_LO_Standard_abc.docx", sPass);
// Standard encryption format, AES 128, SHA1
uno::Reference<text::XTextRange> xParagraph(getParagraph(1));
CPPUNIT_ASSERT_EQUAL(u"ABC"_ustr, xParagraph->getString());
CPPUNIT_ASSERT_EQUAL(u"ABC"_ustr, getParagraph(1)->getString());
saveAndReload(mpFilter, sPass);
CPPUNIT_ASSERT_EQUAL(u"ABC"_ustr, getParagraph(1)->getString());
}
CPPUNIT_PLUGIN_IMPLEMENT();

View file

@ -113,12 +113,19 @@ CPPUNIT_TEST_FIXTURE(DocmTest, testDocmSave)
u"application/vnd.ms-word.document.macroEnabled.main+xml");
}
DECLARE_SW_ROUNDTRIP_TEST(testBadDocm, "bad.docm", nullptr, DocmTest)
CPPUNIT_TEST_FIXTURE(DocmTest, testBadDocm)
{
createSwDoc("bad.docm");
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
CPPUNIT_ASSERT(pTextDoc);
// This was 'MS Word 2007 XML', broken docm files were not recognized.
CPPUNIT_ASSERT_EQUAL(u"MS Word 2007 XML VBA"_ustr, pTextDoc->GetDocShell()->GetMedium()->GetFilter()->GetName());
saveAndReload(mpFilter);
pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
CPPUNIT_ASSERT(pTextDoc);
// This was 'MS Word 2007 XML', broken docm files were not recognized.
CPPUNIT_ASSERT_EQUAL(u"MS Word 2007 XML VBA"_ustr, pTextDoc->GetDocShell()->GetMedium()->GetFilter()->GetName());
}
CPPUNIT_TEST_FIXTURE(Test, testTdf109063)