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:
@@ -72,9 +72,29 @@ void SdrUIObject::execute(const OUString& rAction,
|
|||||||
}
|
}
|
||||||
else if (rAction == "RESIZE")
|
else if (rAction == "RESIZE")
|
||||||
{
|
{
|
||||||
Point aPos;
|
auto itrNX = rParameters.find("X");
|
||||||
Fraction aFracX;
|
if (itrNX == rParameters.end())
|
||||||
Fraction aFracY;
|
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;
|
bool bRelative = true;
|
||||||
pObj->Resize(aPos, aFracX, aFracY, bRelative);
|
pObj->Resize(aPos, aFracX, aFracY, bRelative);
|
||||||
}
|
}
|
||||||
|
@@ -33,3 +33,22 @@ class ImpressDrawinglayerTest(UITestCase):
|
|||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
|
|
||||||
self.ui_test.close_doc()
|
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()
|
||||||
|
Reference in New Issue
Block a user