summaryrefslogtreecommitdiff
path: root/test/source
diff options
context:
space:
mode:
authorJens Carl <j.carl43@gmx.de>2018-03-29 06:24:58 +0000
committerJens Carl <j.carl43@gmx.de>2018-03-30 22:37:21 +0200
commit940f90f3da170b62379e9d1d33d4e6d690997026 (patch)
tree4d2c8162b511bc0e08c1e23f41d48cfe6c765f96 /test/source
parentb16eb0d91f204823339a78b353dc8097aa8f7e56 (diff)
Add UNO API property tester for common read-only properties.
Add UNO API property tester for read-only properties 'double', 'long', 'short' and 'string'. Change-Id: I7177e133972058b0272a3cf8493521fbfbcade32 Reviewed-on: https://gerrit.libreoffice.org/52142 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jens Carl <j.carl43@gmx.de>
Diffstat (limited to 'test/source')
-rw-r--r--test/source/unoapi_property_testers.cxx87
1 files changed, 82 insertions, 5 deletions
diff --git a/test/source/unoapi_property_testers.cxx b/test/source/unoapi_property_testers.cxx
index 14f4b3103e47..67589367ad99 100644
--- a/test/source/unoapi_property_testers.cxx
+++ b/test/source/unoapi_property_testers.cxx
@@ -63,19 +63,38 @@ void testDoubleProperty(uno::Reference<beans::XPropertySet>& xPropertySet, const
{
uno::Any aNewValue;
- double nPropertyGet;
- double nPropertySet;
+ double dPropertyGet;
+ double dPropertySet;
OString msgGet
= "Unable to get PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8);
- CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= nPropertyGet);
+ CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= dPropertyGet);
aNewValue <<= dValue;
xPropertySet->setPropertyValue(name, aNewValue);
- CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= nPropertySet);
+ CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= dPropertySet);
OString msgSet
= "Unable to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8);
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(msgSet.getStr(), dValue, nPropertySet, 0.5);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(msgSet.getStr(), dValue, dPropertySet, 0.5);
+}
+
+void testDoubleReadonlyProperty(uno::Reference<beans::XPropertySet>& xPropertySet,
+ const OUString& name, const double& dValue)
+{
+ uno::Any aNewValue;
+
+ double dPropertyGet;
+ double dPropertySet;
+
+ OString msgGet
+ = "Unable to get PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8);
+ CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= dPropertyGet);
+
+ aNewValue <<= dValue;
+ xPropertySet->setPropertyValue(name, aNewValue);
+ CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= dPropertySet);
+ OString msgSet = "Able to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(msgSet.getStr(), dPropertyGet, dPropertySet, 0.5);
}
void testLongProperty(uno::Reference<beans::XPropertySet>& xPropertySet, const OUString& name,
@@ -98,6 +117,25 @@ void testLongProperty(uno::Reference<beans::XPropertySet>& xPropertySet, const O
CPPUNIT_ASSERT_EQUAL_MESSAGE(msgSet.getStr(), nValue, nPropertySet);
}
+void testLongReadonlyProperty(uno::Reference<beans::XPropertySet>& xPropertySet,
+ const OUString& name, const sal_Int32& nValue)
+{
+ uno::Any aNewValue;
+
+ sal_Int32 nPropertyGet;
+ sal_Int32 nPropertySet;
+
+ OString msgGet
+ = "Unable to get PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8);
+ CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= nPropertyGet);
+
+ aNewValue <<= nValue;
+ xPropertySet->setPropertyValue(name, aNewValue);
+ CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= nPropertySet);
+ OString msgSet = "Able to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(msgSet.getStr(), nPropertyGet, nPropertySet);
+}
+
void testShortProperty(uno::Reference<beans::XPropertySet>& xPropertySet, const OUString& name,
const sal_Int16& nValue)
{
@@ -118,6 +156,25 @@ void testShortProperty(uno::Reference<beans::XPropertySet>& xPropertySet, const
CPPUNIT_ASSERT_EQUAL_MESSAGE(msgSet.getStr(), nValue, nPropertySet);
}
+void testShortReadonlyProperty(uno::Reference<beans::XPropertySet>& xPropertySet,
+ const OUString& name, const sal_Int16& nValue)
+{
+ uno::Any aNewValue;
+
+ sal_Int16 nPropertyGet;
+ sal_Int16 nPropertySet;
+
+ OString msgGet
+ = "Unable to get PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8);
+ CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= nPropertyGet);
+
+ aNewValue <<= nValue;
+ xPropertySet->setPropertyValue(name, aNewValue);
+ CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= nPropertySet);
+ OString msgSet = "Able to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(msgSet.getStr(), nPropertyGet, nPropertySet);
+}
+
void testStringProperty(uno::Reference<beans::XPropertySet>& xPropertySet, const OUString& name,
const OUString& rValue)
{
@@ -137,5 +194,25 @@ void testStringProperty(uno::Reference<beans::XPropertySet>& xPropertySet, const
= "Unable to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8);
CPPUNIT_ASSERT_EQUAL_MESSAGE(msgSet.getStr(), rValue, sPropertySet);
}
+
+void testStringReadonlyProperty(uno::Reference<beans::XPropertySet>& xPropertySet,
+ const OUString& name, const OUString& rValue)
+{
+ uno::Any aNewValue;
+
+ OUString sPropertyGet;
+ OUString sPropertySet;
+
+ OString msgGet
+ = "Unable to get PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8);
+ CPPUNIT_ASSERT_MESSAGE(msgGet.getStr(), xPropertySet->getPropertyValue(name) >>= sPropertyGet);
+
+ aNewValue <<= rValue;
+ xPropertySet->setPropertyValue(name, aNewValue);
+ CPPUNIT_ASSERT(xPropertySet->getPropertyValue(name) >>= sPropertySet);
+ OString msgSet = "Able to set PropertyValue: " + OUStringToOString(name, RTL_TEXTENCODING_UTF8);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(msgSet.getStr(), sPropertyGet, sPropertySet);
}
+} // namespace apitest
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */