add resizing support to drawinglayer ui test objects

Change-Id: Ic17b32c25677855388ff49f2f7daeb1a84557fde
Reviewed-on: https://gerrit.libreoffice.org/29419
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Jenkins <ci@libreoffice.org>
This commit is contained in:
Markus Mohrhard
2016-09-30 21:40:20 +02:00
parent 7d1b897287
commit 88488d579b
2 changed files with 42 additions and 3 deletions

View File

@@ -72,9 +72,29 @@ void SdrUIObject::execute(const OUString& rAction,
}
else if (rAction == "RESIZE")
{
Point aPos;
Fraction aFracX;
Fraction aFracY;
auto itrNX = rParameters.find("X");
if (itrNX == rParameters.end())
throw css::uno::RuntimeException("missing parameter X");
auto itrNY = rParameters.find("Y");
if (itrNY == rParameters.end())
throw css::uno::RuntimeException("missing parameter Y");
long nX = itrNX->second.toInt32();
long nY = itrNY->second.toInt32();
Point aPos(nX, nY);
auto itrFracX = rParameters.find("FRAC_X");
if (itrFracX == rParameters.end())
throw css::uno::RuntimeException("missing parameter FRAC_X");
double nFracX = itrFracX->second.toDouble();
Fraction aFracX(nFracX);
auto itrFracY = rParameters.find("FRAC_Y");
if (itrFracY == rParameters.end())
throw css::uno::RuntimeException("missing parameter FRAC_Y");
double nFracY = itrFracY->second.toDouble();
Fraction aFracY(nFracY);
bool bRelative = true;
pObj->Resize(aPos, aFracX, aFracY, bRelative);
}

View File

@@ -33,3 +33,22 @@ class ImpressDrawinglayerTest(UITestCase):
time.sleep(10)
self.ui_test.close_doc()
def test_resize_object(self):
self.ui_test.create_doc_in_start_center("impress")
xTemplateDlg = self.xUITest.getTopFocusWindow()
xCancelBtn = xTemplateDlg.getChild("cancel")
self.ui_test.close_dialog_through_button(xCancelBtn)
xImpressDoc = self.xUITest.getTopFocusWindow()
xEditWin = xImpressDoc.getChild("impress_win")
xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1")
print(get_state_as_dict(xDrawinglayerObject))
xDrawinglayerObject.executeAction("RESIZE", mkPropertyValues({"X": "500", "Y":"4000", "FRAC_X": "0.5", "FRAC_Y": "0.5"}))
time.sleep(5)
self.ui_test.close_doc()