diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-09-30 21:25:37 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-10-01 14:36:52 +0000 |
commit | 786971a13adba78072c0ec03101c6c63d76a432f (patch) | |
tree | a3885fa9f2c560a33a52f93bb37525dd98584d22 /svx | |
parent | d751af3f84909996d44b9354ce9ed34891d374e1 (diff) |
add initial drawinglayer support to UI testing framework
Change-Id: Id0450cdf655accb6bd1a50871e83d5c8ecdaab5f
Reviewed-on: https://gerrit.libreoffice.org/29417
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/Library_svxcore.mk | 1 | ||||
-rw-r--r-- | svx/source/uitest/sdrobject.cxx | 113 |
2 files changed, 114 insertions, 0 deletions
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index a3fdf0274a63..00ebc04c7d8d 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -474,6 +474,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/form/stringlistresource \ svx/source/form/typemap \ svx/source/form/xfm_addcondition \ + svx/source/uitest/sdrobject \ )) $(eval $(call gb_SdiTarget_SdiTarget,svx/sdi/svxslots,svx/sdi/svx)) diff --git a/svx/source/uitest/sdrobject.cxx b/svx/source/uitest/sdrobject.cxx new file mode 100644 index 000000000000..9142cfdb3db1 --- /dev/null +++ b/svx/source/uitest/sdrobject.cxx @@ -0,0 +1,113 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <svx/uiobject.hxx> + +#include <svx/svdobj.hxx> + +#include <tools/fract.hxx> + +SdrUIObject::~SdrUIObject() +{ +} + +StringMap SdrUIObject::get_state() +{ + StringMap aMap; + SdrObject* pObject = get_object(); + + if (!pObject) + return aMap; + + aMap["Name"] = pObject->GetName(); + aMap["Description"] = pObject->GetDescription(); + aMap["Title"] = pObject->GetTitle(); + aMap["Z-Order"] = OUString::number(pObject->GetOrdNum()); + aMap["Layer"] = OUString::number(pObject->GetLayer()); + aMap["IsGroupObject"] = OUString::boolean(pObject->IsGroupObject()); + aMap["IsPolyObject"] = OUString::boolean(pObject->IsPolyObj()); + aMap["PointCount"] = OUString::number(pObject->GetPointCount()); + aMap["HasTextEdit"] = OUString::boolean(pObject->HasTextEdit()); + aMap["HasMacro"] = OUString::boolean(pObject->HasMacro()); + aMap["IsClosed"] = OUString::boolean(pObject->IsClosedObj()); + aMap["IsEdgeObject"] = OUString::boolean(pObject->IsEdgeObj()); + aMap["Is3DObject"] = OUString::boolean(pObject->Is3DObj()); + aMap["IsUNOObject"] = OUString::boolean(pObject->IsUnoObj()); + aMap["MoveProtected"] = OUString::boolean(pObject->IsMoveProtect()); + aMap["ResizeProtected"] = OUString::boolean(pObject->IsResizeProtect()); + aMap["Printable"] = OUString::boolean(pObject->IsPrintable()); + aMap["Visible"] = OUString::boolean(pObject->IsVisible()); + aMap["HasText"] = OUString::boolean(pObject->HasText()); + + return aMap; +} + +void SdrUIObject::execute(const OUString& rAction, + const StringMap& rParameters) +{ + SdrObject* pObj = get_object(); + if (!pObj) + return; + + if (rAction == "MOVE") + { + 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(); + Size aMoveRange(nX, nY); + pObj->Move(aMoveRange); + } + else if (rAction == "RESIZE") + { + Point aPos; + Fraction aFracX; + Fraction aFracY; + bool bRelative = true; + pObj->Resize(aPos, aFracX, aFracY, bRelative); + } + else if (rAction == "CROP") + { + Point aPos; + Fraction aFracX; + Fraction aFracY; + pObj->Crop(aPos, aFracX, aFracY); + } + else if (rAction == "Rotate") + { + Point aPos; + double nAngle = 0; + pObj->Rotate(aPos, nAngle, 0, 0); + } + else if (rAction == "Mirror") + { + Point aPos; + Point aPos2; + pObj->Mirror(aPos, aPos2); + } + else if (rAction == "SHEAR") + { + Point aPos; + double nAngle = 0; + pObj->Shear(aPos, nAngle, 0, false); + } +} + +OUString SdrUIObject::get_type() const +{ + return OUString("SdrUIObject"); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |