summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2020-03-30 19:38:31 -0400
committerHenry Castro <hcastro@collabora.com>2020-04-01 08:47:09 -0400
commit275cafa6456be98dd3553285e30874e4ca103cba (patch)
tree7c1e5743fa2023eba137b44323d3fdac30b527c5
parent52ef588267d191304138a88b962314b5dec84356 (diff)
lok: unit test GetControlStatefeature/controlstate
Change-Id: I7187fe787aaed33d85ad76b612725741e9f586d9
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 101fdda65742..ea7206b3720d 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -50,6 +50,7 @@
#include <config_features.h>
#include <lib/init.hxx>
+#include <svx/svxids.hrc>
using namespace com::sun::star;
using namespace desktop;
@@ -171,6 +172,7 @@ public:
void testDialogPaste();
void testCalcSaveAs();
void testDialogInput();
+ void testControlState();
void testABI();
CPPUNIT_TEST_SUITE(DesktopLOKTest);
@@ -227,6 +229,7 @@ public:
CPPUNIT_TEST(testDialogPaste);
CPPUNIT_TEST(testCalcSaveAs);
CPPUNIT_TEST(testDialogInput);
+ CPPUNIT_TEST(testControlState);
CPPUNIT_TEST(testABI);
CPPUNIT_TEST_SUITE_END();
@@ -2772,6 +2775,26 @@ void DesktopLOKTest::testSpellcheckerMultiView()
CPPUNIT_ASSERT_EQUAL(1, pDocument->m_pDocumentClass->getViewsCount(pDocument));
}
+void DesktopLOKTest::testControlState()
+{
+ LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
+ pDocument->pClass->postUnoCommand(pDocument, ".uno:BasicShapes.hexagon", nullptr, false);
+ Scheduler::ProcessEventsToIdle();
+
+ boost::property_tree::ptree aState;
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ pViewShell->GetViewFrame()->GetBindings().Update();
+ Scheduler::ProcessEventsToIdle();
+
+ pViewShell->GetViewFrame()->GetBindings().QueryControlState(SID_ATTR_TRANSFORM_WIDTH, aState);
+ {
+ std::ostringstream oss;
+ boost::property_tree::write_json(oss, aState);
+ std::cerr << "DEBUG aState: " << oss.str() << std::endl;
+ }
+ CPPUNIT_ASSERT(!aState.empty());
+}
+
namespace {
constexpr size_t classOffset(int i)