tdf#107690 DOCX, XLSX and PPTX unit tests for "Open as read-only"
ie. OOXML export/import of "_MarkAsFinal" MSO document property. Change-Id: I01f0702d5467e78eb93ce8dce8ba25874839c3e3 Reviewed-on: https://gerrit.libreoffice.org/56475 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
This commit is contained in:
BIN
sc/qa/unit/data/xlsx/open-as-read-only.xlsx
Normal file
BIN
sc/qa/unit/data/xlsx/open-as-read-only.xlsx
Normal file
Binary file not shown.
@@ -207,6 +207,7 @@ public:
|
||||
|
||||
void testHiddenRepeatedRowsODS();
|
||||
void testHyperlinkTargetFrameODS();
|
||||
void testOpenDocumentAsReadOnly();
|
||||
|
||||
CPPUNIT_TEST_SUITE(ScExportTest);
|
||||
CPPUNIT_TEST(test);
|
||||
@@ -313,6 +314,7 @@ public:
|
||||
|
||||
CPPUNIT_TEST(testHiddenRepeatedRowsODS);
|
||||
CPPUNIT_TEST(testHyperlinkTargetFrameODS);
|
||||
CPPUNIT_TEST(testOpenDocumentAsReadOnly);
|
||||
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
@@ -4023,6 +4025,16 @@ void ScExportTest::testHyperlinkTargetFrameODS()
|
||||
CPPUNIT_ASSERT_EQUAL(OUString("_blank"), aTargetFrameExport);
|
||||
}
|
||||
|
||||
void ScExportTest::testOpenDocumentAsReadOnly()
|
||||
{
|
||||
ScDocShellRef xDocSh = loadDoc("open-as-read-only.", FORMAT_XLSX);
|
||||
CPPUNIT_ASSERT(xDocSh->IsSecurityOptOpenReadOnly());
|
||||
ScDocShellRef xDocSh2 = saveAndReload(xDocSh.get(), FORMAT_XLSX);
|
||||
CPPUNIT_ASSERT(xDocSh2->IsSecurityOptOpenReadOnly());
|
||||
xDocSh->DoClose();
|
||||
xDocSh2->DoClose();
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
BIN
sd/qa/unit/data/pptx/open-as-read-only.pptx
Normal file
BIN
sd/qa/unit/data/pptx/open-as-read-only.pptx
Normal file
Binary file not shown.
@@ -145,6 +145,7 @@ public:
|
||||
void testTdf90627();
|
||||
void testTdf104786();
|
||||
void testTdf104789();
|
||||
void testOpenDocumentAsReadOnly();
|
||||
|
||||
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
|
||||
|
||||
@@ -211,6 +212,7 @@ public:
|
||||
CPPUNIT_TEST(testTdf90627);
|
||||
CPPUNIT_TEST(testTdf104786);
|
||||
CPPUNIT_TEST(testTdf104789);
|
||||
CPPUNIT_TEST(testOpenDocumentAsReadOnly);
|
||||
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
@@ -1682,6 +1684,16 @@ void SdOOXMLExportTest2::testTdf104789()
|
||||
xDocShRef->DoClose();
|
||||
}
|
||||
|
||||
void SdOOXMLExportTest2::testOpenDocumentAsReadOnly()
|
||||
{
|
||||
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/open-as-read-only.pptx"), PPTX);
|
||||
CPPUNIT_ASSERT(xDocShRef->IsSecurityOptOpenReadOnly());
|
||||
utl::TempFile tempFile;
|
||||
xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
|
||||
CPPUNIT_ASSERT(xDocShRef->IsSecurityOptOpenReadOnly());
|
||||
xDocShRef->DoClose();
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
BIN
sw/qa/extras/ooxmlexport/data/open-as-read-only.docx
Normal file
BIN
sw/qa/extras/ooxmlexport/data/open-as-read-only.docx
Normal file
Binary file not shown.
@@ -408,6 +408,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf107969, "tdf107969.docx")
|
||||
// SAXParseException: '[word/document.xml line 2]: Extra content at the end of the document', Stream 'word/document.xml'.
|
||||
}
|
||||
|
||||
DECLARE_OOXMLEXPORT_TEST(testOpenDocumentAsReadOnly, "open-as-read-only.docx")
|
||||
{
|
||||
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
|
||||
CPPUNIT_ASSERT(pTextDoc);
|
||||
CPPUNIT_ASSERT(pTextDoc->GetDocShell()->IsSecurityOptOpenReadOnly());
|
||||
}
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
Reference in New Issue
Block a user