diff options
author | Henry Castro <hcastro@collabora.com> | 2020-05-07 16:47:36 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2020-05-10 14:15:31 +0200 |
commit | 5adf102b26f3f9e8ae860a213ee66c363485a041 (patch) | |
tree | 234ed1874fb238c7a6b159bf8f3394ee1b4dd4d4 /desktop/qa | |
parent | 3164a9a0b7603c0d3ef52bc1ed223ab481294fb3 (diff) |
lok: unit test for metric field or formatted field control
Change-Id: I0a3efef85ff889c4214ab326d1de96a4acd207a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93779
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Henry Castro <hcastro@collabora.com>
Diffstat (limited to 'desktop/qa')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 8a3f2d3efc9a..90d1042d2e48 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -26,9 +26,12 @@ #include <vcl/svapp.hxx> #include <vcl/syswin.hxx> #include <vcl/window.hxx> +#include <vcl/uitest/uiobject.hxx> #include <comphelper/processfactory.hxx> #include <rtl/uri.hxx> #include <sfx2/objsh.hxx> +#include <sfx2/app.hxx> +#include <sfx2/childwin.hxx> #include <sfx2/lokhelper.hxx> #include <test/unoapi_test.hxx> #include <comphelper/lok.hxx> @@ -173,6 +176,7 @@ public: void testCalcSaveAs(); void testDialogInput(); void testControlState(); + void testMetricField(); void testABI(); CPPUNIT_TEST_SUITE(DesktopLOKTest); @@ -230,6 +234,7 @@ public: CPPUNIT_TEST(testCalcSaveAs); CPPUNIT_TEST(testDialogInput); CPPUNIT_TEST(testControlState); + CPPUNIT_TEST(testMetricField); CPPUNIT_TEST(testABI); CPPUNIT_TEST_SUITE_END(); @@ -2788,6 +2793,36 @@ void DesktopLOKTest::testControlState() CPPUNIT_ASSERT(!aState.empty()); } +void DesktopLOKTest::testMetricField() +{ + LibLODocument_Impl* pDocument = loadDoc("search.ods"); + pDocument->pClass->postUnoCommand(pDocument, ".uno:StarShapes", nullptr, false); + Scheduler::ProcessEventsToIdle(); + + SfxViewShell* pViewShell = SfxViewShell::Current(); + CPPUNIT_ASSERT(pViewShell); + + SfxViewFrame* pViewFrame = pViewShell->GetViewFrame(); + CPPUNIT_ASSERT(pViewFrame); + + SfxChildWindow* pSideBar = pViewFrame->GetChildWindow(SID_SIDEBAR); + CPPUNIT_ASSERT(pSideBar); + + vcl::Window* pWin = pSideBar->GetWindow(); + CPPUNIT_ASSERT(pWin); + + WindowUIObject aWinUI(pWin); + std::unique_ptr<UIObject> pUIWin(aWinUI.get_child("selectwidth")); + CPPUNIT_ASSERT(pUIWin.get()); + + StringMap aMap; + aMap["VALUE"] = "75.06"; + pUIWin->execute("VALUE", aMap); + + StringMap aRet = pUIWin->get_state(); + CPPUNIT_ASSERT_EQUAL(aMap["VALUE"], aRet["Value"]); +} + namespace { constexpr size_t classOffset(int i) |