summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2024-10-29 12:25:55 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2024-10-29 13:50:40 +0100
commit30dee23a769ee81cef7c6b4fe95f2fd661e97b9b (patch)
treef6bfcebd87f4893f57b3cd59ce26b7a1e057f92b /sw
parentca1f1962ae163345ecaedc288244448589ae2a0e (diff)
UnoApiTest: check mxComponent right after loading
Change-Id: Ia834d19a5af999440f7d5847aeeae863daacd952 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175784 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/layout/layout2.cxx1
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport16.cxx2
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport17.cxx11
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx1
-rw-r--r--sw/qa/extras/uiwriter/uiwriter6.cxx9
-rw-r--r--sw/qa/extras/uiwriter/uiwriter7.cxx1
-rw-r--r--sw/qa/extras/unowriter/unowriter.cxx3
7 files changed, 5 insertions, 23 deletions
diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx
index 5b5e066e1ad5..7cec93649e7c 100644
--- a/sw/qa/extras/layout/layout2.cxx
+++ b/sw/qa/extras/layout/layout2.cxx
@@ -1535,7 +1535,6 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf116256)
{
// Open bugdoc
createSwDoc("tdf116256.docx");
- CPPUNIT_ASSERT(mxComponent);
// Get the textbox
uno::Reference<beans::XPropertySet> xTextBox(getShape(2), uno::UNO_QUERY_THROW);
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index 67f6dccb51bb..f4dbdaec15bc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -835,8 +835,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153874, "image_through_shape.docx")
DECLARE_OOXMLEXPORT_TEST(testTextBoxZOrder, "testTextBoxZOrder.docx")
{
- // Is load successful?
- CPPUNIT_ASSERT(mxComponent);
// Collect the z-order values of the textboxes
std::vector<sal_uInt64> ShapeZorders;
std::vector<sal_uInt64> FrameZorders;
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
index 5e17304587c3..95a755c3bb29 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx
@@ -215,9 +215,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf135906)
DECLARE_OOXMLEXPORT_TEST(testTdf146802, "tdf146802.docx")
{
- // First check if the load failed, as before the fix.
- CPPUNIT_ASSERT(mxComponent);
-
// There is a group shape with text box inside having an embedded VML formula,
// check if something missing.
CPPUNIT_ASSERT_EQUAL_MESSAGE("Where is the formula?", 2, getShapes());
@@ -553,9 +550,6 @@ CPPUNIT_TEST_FIXTURE(Test, testDontAddNewStyles)
DECLARE_OOXMLEXPORT_TEST(TestWPGZOrder, "testWPGZOrder.docx")
{
- // Check if the load failed.
- CPPUNIT_ASSERT(mxComponent);
-
// Get the WPG
uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY_THROW);
uno::Reference<beans::XPropertySet> xGroupProperties(xGroup, uno::UNO_QUERY_THROW);
@@ -766,9 +760,6 @@ DECLARE_OOXMLEXPORT_TEST(testTdf142407, "tdf142407.docx")
DECLARE_OOXMLEXPORT_TEST(testWPGBodyPr, "WPGbodyPr.docx")
{
- // Is load successful?
- CPPUNIT_ASSERT(mxComponent);
-
// There are a WPG shape and a picture
CPPUNIT_ASSERT_EQUAL(2, getShapes());
@@ -899,8 +890,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf148111)
DECLARE_OOXMLEXPORT_TEST(TestTdf73499, "tdf73499.docx")
{
- // Ensure, the bugdoc is opened
- CPPUNIT_ASSERT(mxComponent);
// Get the groupshape
uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY_THROW);
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index cbd860f0aabf..ff04ed301bfa 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -563,7 +563,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testVariableFieldTableRowSplitHeader)
CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf147126)
{
createSwDoc("tdf147126.docx");
- CPPUNIT_ASSERT(mxComponent);
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
CPPUNIT_ASSERT(pTextDoc);
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx
index c5caa395fc59..e76982737286 100644
--- a/sw/qa/extras/uiwriter/uiwriter6.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter6.cxx
@@ -660,7 +660,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf113790)
// Save it as DOCX & load it again
saveAndReload(u"Office Open XML Text"_ustr);
- CPPUNIT_ASSERT(dynamic_cast<SwXTextDocument*>(mxComponent.get()));
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157937)
@@ -3228,6 +3227,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testNestedGroupTextBoxCopyCrash)
{
createSwDoc("tdf149550.docx");
+ CPPUNIT_ASSERT_EQUAL(1, getShapes());
+
dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
dispatchCommand(mxComponent, u".uno:Copy"_ustr, {});
// This crashed here before the fix.
@@ -3236,7 +3237,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testNestedGroupTextBoxCopyCrash)
Scheduler::ProcessEventsToIdle();
dispatchCommand(mxComponent, u".uno:Paste"_ustr, {});
- CPPUNIT_ASSERT_MESSAGE("Where is the doc, it crashed, isn't it?!", mxComponent);
+ CPPUNIT_ASSERT_EQUAL(2, getShapes());
auto pLayout = parseLayoutDump();
// There must be 2 textboxes!
@@ -3269,10 +3270,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testCrashOnExit)
CPPUNIT_ASSERT_EQUAL(true, xProperties->getPropertyValue(u"TextBox"_ustr).get<bool>());
// save and reload
- saveAndReload(u"writer8"_ustr);
-
// Before the fix this crashed here and could not reopen.
- CPPUNIT_ASSERT_MESSAGE("Crash on exit, isn't it?", mxComponent);
+ saveAndReload(u"writer8"_ustr);
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testCaptionShape)
diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx
index 429fe7ce931d..bff6c0f3a46f 100644
--- a/sw/qa/extras/uiwriter/uiwriter7.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter7.cxx
@@ -2180,7 +2180,6 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testEmbeddedDataSource)
// Reload: should still have a component and a data source, too.
saveAndReload(u"writer8"_ustr);
- CPPUNIT_ASSERT(mxComponent.is());
CPPUNIT_ASSERT(xDatabaseContext->hasByName(u"calc-data-source"_ustr));
// Data source has a table named Sheet1 after saving to a different directory.
diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx
index 67fb87671559..42c9a90f9c19 100644
--- a/sw/qa/extras/unowriter/unowriter.cxx
+++ b/sw/qa/extras/unowriter/unowriter.cxx
@@ -896,8 +896,6 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testRenderablePagePosition)
{
createSwDoc("renderable-page-position.odt");
// Make sure that the document has 2 pages.
- uno::Reference<view::XRenderable> xRenderable(mxComponent, uno::UNO_QUERY);
- CPPUNIT_ASSERT(mxComponent.is());
uno::Any aSelection(mxComponent);
@@ -914,6 +912,7 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testRenderablePagePosition)
comphelper::makePropertyValue(u"RenderToGraphic"_ustr, true),
};
+ uno::Reference<view::XRenderable> xRenderable(mxComponent, uno::UNO_QUERY);
sal_Int32 nPages = xRenderable->getRendererCount(aSelection, aRenderOptions);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2), nPages);