Skip to content

Commit

Permalink
lok: unit test for metric field or formatted field control
Browse files Browse the repository at this point in the history
Change-Id: I0a3efef85ff889c4214ab326d1de96a4acd207a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93689
Tested-by: Jenkins
Reviewed-by: Henry Castro <[email protected]>
  • Loading branch information
hcvcastro committed May 11, 2020
1 parent a406b4f commit 2f4ea95
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions desktop/qa/desktop_lib/test_desktop_lib.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
#include <vcl/syswin.hxx>
#include <vcl/window.hxx>
#include <vcl/ctrl.hxx>
#include <vcl/uitest/uiobject.hxx>
#include <comphelper/processfactory.hxx>
#include <rtl/math.hxx>
#include <rtl/uri.hxx>
#include <sfx2/app.hxx>
#include <sfx2/childwin.hxx>
#include <sfx2/lokhelper.hxx>
#include <test/unoapi_test.hxx>
#include <comphelper/lok.hxx>
Expand Down Expand Up @@ -173,6 +175,7 @@ class DesktopLOKTest : public UnoApiTest
void testDialogInput();
void testCalcSaveAs();
void testControlState();
void testMetricField();
void testABI();

CPPUNIT_TEST_SUITE(DesktopLOKTest);
Expand Down Expand Up @@ -233,6 +236,7 @@ class DesktopLOKTest : public UnoApiTest
CPPUNIT_TEST(testDialogInput);
CPPUNIT_TEST(testCalcSaveAs);
CPPUNIT_TEST(testControlState);
CPPUNIT_TEST(testMetricField);
CPPUNIT_TEST(testABI);
CPPUNIT_TEST_SUITE_END();

Expand Down Expand Up @@ -2827,6 +2831,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)
Expand Down

0 comments on commit 2f4ea95

Please sign in to comment.