[Libreoffice-commits] core.git: test/inc test/source
Jens Carl (via logerrit)
logerrit at kemper.freedesktop.org
Thu Mar 28 18:56:00 UTC 2019
test/inc/helper/form.hxx | 17 ++++++++++++-----
test/source/helper/form.cxx | 25 +++++++++++++++----------
test/source/view/xcontrolaccess.cxx | 5 +++--
3 files changed, 30 insertions(+), 17 deletions(-)
New commits:
commit 1e2868296730d3548574f61a3c6e323aa5c0598a
Author: Jens Carl <j.carl43 at gmx.de>
AuthorDate: Wed Mar 27 19:34:16 2019 +0000
Commit: Jens Carl <j.carl43 at gmx.de>
CommitDate: Thu Mar 28 19:55:35 2019 +0100
Be consistent with namespaces and parameter order for UNO Api helpers
Have this file the same namespaces as the new introduced helpers in
include/test/helper/shape.hxx and also change the order of the parameter
be the same to avoid confusion.
Change-Id: I5614e9a79dff3ee9aca96ff2e50ddfafa83de539
Reviewed-on: https://gerrit.libreoffice.org/69870
Tested-by: Jenkins
Reviewed-by: Jens Carl <j.carl43 at gmx.de>
diff --git a/test/inc/helper/form.hxx b/test/inc/helper/form.hxx
index 173306b118c8..271f06be0b7e 100644
--- a/test/inc/helper/form.hxx
+++ b/test/inc/helper/form.hxx
@@ -22,19 +22,26 @@
namespace apitest
{
+namespace helper
+{
+namespace form
+{
/** @brief Create a XControlShape
*
* @param r_xComponent The document.
- * @param nHeight The height of the shape.
- * @param nWidth The width of the shape.
+ * @param r_aKind The kind of the shape.
* @param nX The x-position of the shape.
* @param nY The y-position of the shape.
- * @param r_aKind The kind of the shape.
+ * @param nHeight The height of the shape.
+ * @param nWidth The width of the shape.
+ * @return The create XControlShape.
*/
css::uno::Reference<css::drawing::XControlShape> OOO_DLLPUBLIC_TEST createControlShape(
- const css::uno::Reference<css::lang::XComponent>& r_xComponent, const sal_Int32 nHeight,
- const sal_Int32 nWidth, const sal_Int32 nX, const sal_Int32 nY, const OUString& r_aKind);
+ const css::uno::Reference<css::lang::XComponent>& r_xComponent, const OUString& r_aKind,
+ const sal_Int32 nX, const sal_Int32 nY, const sal_Int32 nHeight, const sal_Int32 nWidth);
+} // namespace form
+} // namespace helper
} // namespace apitest
#endif // INCLUDED_TEST_INC_HELPER_FORM_HXX
diff --git a/test/source/helper/form.cxx b/test/source/helper/form.cxx
index 47da3565f79d..610bd43f1a51 100644
--- a/test/source/helper/form.cxx
+++ b/test/source/helper/form.cxx
@@ -8,6 +8,8 @@
*/
#include <helper/form.hxx>
+#include <rtl/string.hxx>
+#include <sal/types.h>
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
@@ -16,19 +18,20 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Reference.hxx>
-#include <rtl/string.hxx>
-#include <sal/types.h>
-
using namespace css;
namespace apitest
{
-uno::Reference<drawing::XControlShape>
-createControlShape(const uno::Reference<lang::XComponent>& r_xComponent, const sal_Int32 nHeight,
- const sal_Int32 nWidth, const sal_Int32 nX, const sal_Int32 nY,
- const OUString& r_aKind)
+namespace helper
+{
+namespace form
+{
+uno::Reference<drawing::XControlShape> OOO_DLLPUBLIC_TEST createControlShape(
+ const uno::Reference<lang::XComponent>& r_xComponent, const OUString& r_aKind,
+ const sal_Int32 nX, const sal_Int32 nY, const sal_Int32 nHeight, const sal_Int32 nWidth)
{
uno::Reference<lang::XMultiServiceFactory> xMSF(r_xComponent, uno::UNO_QUERY_THROW);
@@ -38,9 +41,8 @@ createControlShape(const uno::Reference<lang::XComponent>& r_xComponent, const s
uno::Reference<uno::XInterface> aComponent(
xMSF->createInstance("com.sun.star.form.component." + r_aKind), uno::UNO_QUERY_THROW);
uno::Reference<beans::XPropertySet> xPropertySet(aComponent, uno::UNO_QUERY_THROW);
- uno::Any aValue;
- aValue <<= "com.sun.star.form.control." + r_aKind;
- xPropertySet->setPropertyValue("DefaultControl", aValue);
+ xPropertySet->setPropertyValue("DefaultControl",
+ uno::makeAny("com.sun.star.form.control." + r_aKind));
uno::Reference<awt::XControlModel> xControlModel(aComponent, uno::UNO_QUERY_THROW);
xControlShape->setSize(awt::Size(nHeight, nWidth));
@@ -50,6 +52,9 @@ createControlShape(const uno::Reference<lang::XComponent>& r_xComponent, const s
return xControlShape;
}
+
+} // namespace form
+} // namespace helper
} // namespace apitest
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/test/source/view/xcontrolaccess.cxx b/test/source/view/xcontrolaccess.cxx
index 29ca1fa339aa..5f00e88a5f63 100644
--- a/test/source/view/xcontrolaccess.cxx
+++ b/test/source/view/xcontrolaccess.cxx
@@ -21,10 +21,11 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/view/XControlAccess.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
#include <cppunit/extensions/HelperMacros.h>
using namespace css;
-using namespace css::uno;
namespace apitest
{
@@ -39,7 +40,7 @@ void XControlAccess::testGetControl()
uno::Reference<drawing::XShapes> xShapes(xDP, uno::UNO_QUERY_THROW);
uno::Reference<drawing::XShape> xShape(
- createControlShape(xComponent, 100, 100, 10000, 50000, "CommandButton"),
+ helper::form::createControlShape(xComponent, "CommandButton", 10000, 50000, 100, 100),
uno::UNO_QUERY_THROW);
xShapes->add(xShape);
More information about the Libreoffice-commits
mailing list