summaryrefslogtreecommitdiff
path: root/sw/qa/uibase
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2025-02-12 14:58:36 +0100
committerMiklos Vajna <vmiklos@collabora.com>2025-02-13 16:23:16 +0100
commit449aca5c02c9a927f44b3c6cae99248903fb492c (patch)
tree5baf210ba6a4638a2d20122ae8a999e5f5b2fc5c /sw/qa/uibase
parent48ac7439438e2d12e78eea08e7a17e6dd1877c80 (diff)
cool#11064 sw lok: expose if layout pages have invalid content
This is meant to help test writing on the LOK client side, for example this allows dispatching a command and once the poll callback of the LOK client is invoked, we can now check if the layout is fully done (slower) or the poll callback is invoked earlier (faster). Change-Id: I56ab4e6fe46f07a205a197c5b7aa5bb15b3ef676 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181619 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa/uibase')
-rw-r--r--sw/qa/uibase/uno/uno.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/sw/qa/uibase/uno/uno.cxx b/sw/qa/uibase/uno/uno.cxx
index 046dd88c6861..2848c367a13b 100644
--- a/sw/qa/uibase/uno/uno.cxx
+++ b/sw/qa/uibase/uno/uno.cxx
@@ -369,6 +369,33 @@ CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetFields)
aRef.get<std::string>("name"));
}
+CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetLayout)
+{
+ // Given a document with 2 pages:
+ createSwDoc();
+ SwDoc* pDoc = getSwDoc();
+ SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+ pWrtShell->InsertPageBreak();
+
+ // When getting info about the layout:
+ tools::JsonWriter aJsonWriter;
+ std::string_view aCommand(".uno:Layout");
+ auto pXTextDocument = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+ pXTextDocument->getCommandValues(aJsonWriter, aCommand);
+
+ // Then make sure we get the 2 pages:
+ OString pJSON(aJsonWriter.finishAndGetAsOString());
+ std::stringstream aStream((std::string(pJSON)));
+ boost::property_tree::ptree aTree;
+ boost::property_tree::read_json(aStream, aTree);
+ auto aPages = aTree.get_child("commandValues").get_child("pages");
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), aPages.count(""));
+ for (const auto& rPage : aPages)
+ {
+ CPPUNIT_ASSERT(!rPage.second.get<bool>("isInvalidContent"));
+ }
+}
+
CPPUNIT_TEST_FIXTURE(SwUibaseUnoTest, testGetTextFormField)
{
// Given a document with a fieldmark: