summaryrefslogtreecommitdiff
path: root/sw/qa/api/ApiTestBase.hxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-01-06 21:59:21 +0100
committerTomaž Vajngerl <quikee@gmail.com>2019-01-10 20:11:21 +0100
commit4631c5d4c129b826df1cc29af1a558149b823667 (patch)
tree202dbb3ff7016f25360d9488f1860cd198f8f091 /sw/qa/api/ApiTestBase.hxx
parent647ad220295e16e05333e4eb801e1c8eac2d77f9 (diff)
DocumentSettings Writer UNO API test (converted from Java test)
Change-Id: Id9a691b1aae62f37ef7f865c5ed015b7c6a13976 Reviewed-on: https://gerrit.libreoffice.org/65909 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw/qa/api/ApiTestBase.hxx')
-rw-r--r--sw/qa/api/ApiTestBase.hxx29
1 files changed, 29 insertions, 0 deletions
diff --git a/sw/qa/api/ApiTestBase.hxx b/sw/qa/api/ApiTestBase.hxx
index 76871111ff3f..fc25bc3122be 100644
--- a/sw/qa/api/ApiTestBase.hxx
+++ b/sw/qa/api/ApiTestBase.hxx
@@ -11,6 +11,9 @@
#define INCLUDED_SW_QA_CORE_APITESTBASE_HXX
#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/beans/XPropertySetInfo.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <unordered_map>
@@ -19,6 +22,32 @@ namespace apitest
class ApiTestBase
{
protected:
+ static bool extstsProperty(css::uno::Reference<css::beans::XPropertySet> const& rxPropertySet,
+ OUString const& rPropertyName)
+ {
+ css::uno::Reference<css::beans::XPropertySetInfo> xPropertySetInfo(
+ rxPropertySet->getPropertySetInfo());
+ return xPropertySetInfo->hasPropertyByName(rPropertyName);
+ }
+
+ static bool
+ isPropertyReadOnly(css::uno::Reference<css::beans::XPropertySet> const& rxPropertySet,
+ OUString const& rPropertyName)
+ {
+ css::uno::Reference<css::beans::XPropertySetInfo> xPropertySetInfo(
+ rxPropertySet->getPropertySetInfo());
+ css::uno::Sequence<css::beans::Property> xProperties = xPropertySetInfo->getProperties();
+
+ for (auto const& rProperty : xProperties)
+ {
+ if (rProperty.Name == rPropertyName)
+ return (rProperty.Attributes & com::sun::star::beans::PropertyAttribute::READONLY)
+ != 0;
+ }
+
+ return false;
+ }
+
virtual ~ApiTestBase() {}
virtual std::unordered_map<OUString, css::uno::Reference<css::uno::XInterface>> init() = 0;