summaryrefslogtreecommitdiff
path: root/configmgr
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-10-05 18:08:02 +0100
committerMichael Meeks <michael.meeks@collabora.com>2015-10-09 08:42:49 +0000
commitccf8bdcf929e842ef42ae968e4f0532282357277 (patch)
treef267454624fc8ceb12d1fd90fc826da4cf8e8c59 /configmgr
parent18b934af9979522c8cff1ff76504ce19c3e6916d (diff)
Create a wrapper to make listening for configmgr changes easy.
Change-Id: Ib58d04f9e046e604b24e0e338796a7a60aa1d6fd Reviewed-on: https://gerrit.libreoffice.org/19253 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'configmgr')
-rw-r--r--configmgr/CppunitTest_configmgr_unit.mk4
-rw-r--r--configmgr/qa/unit/test.cxx47
2 files changed, 51 insertions, 0 deletions
diff --git a/configmgr/CppunitTest_configmgr_unit.mk b/configmgr/CppunitTest_configmgr_unit.mk
index e8bddc24bee8..ca9653fd126e 100644
--- a/configmgr/CppunitTest_configmgr_unit.mk
+++ b/configmgr/CppunitTest_configmgr_unit.mk
@@ -21,6 +21,10 @@ $(eval $(call gb_CppunitTest_use_library_objects,configmgr_unit,configmgr))
$(eval $(call gb_CppunitTest_use_sdk_api,configmgr_unit,))
+$(eval $(call gb_CppunitTest_use_custom_headers,configmgr_unit,\
+ officecfg/registry \
+))
+
$(eval $(call gb_CppunitTest_use_libraries,configmgr_unit, \
comphelper \
cppu \
diff --git a/configmgr/qa/unit/test.cxx b/configmgr/qa/unit/test.cxx
index a9f609bc3677..6985cab57fde 100644
--- a/configmgr/qa/unit/test.cxx
+++ b/configmgr/qa/unit/test.cxx
@@ -55,7 +55,11 @@
#include <rtl/ustring.hxx>
#include <sal/types.h>
#include <comphelper/processfactory.hxx>
+#include <comphelper/configuration.hxx>
+#include <comphelper/configurationlistener.hxx>
+#include <comphelper/configurationlistener.hxx>
#include <unotest/bootstrapfixturebase.hxx>
+#include <officecfg/Office/Math.hxx>
namespace {
@@ -70,6 +74,7 @@ public:
void testSetSetMemberName();
void testInsertSetMember();
void testReadCommands();
+ void testListener();
#if 0
void testThreads();
#endif
@@ -98,6 +103,7 @@ public:
CPPUNIT_TEST(testSetSetMemberName);
CPPUNIT_TEST(testInsertSetMember);
CPPUNIT_TEST(testReadCommands);
+ CPPUNIT_TEST(testListener);
#if 0
CPPUNIT_TEST(testThreads);
#endif
@@ -356,6 +362,47 @@ void Test::testReadCommands()
access, css::uno::UNO_QUERY_THROW)->dispose();
}
+void Test::testListener()
+{
+ OUString aRandomPath = "/org.openoffice.Office.Math/View";
+
+ // test with no props.
+ {
+ rtl::Reference<comphelper::ConfigurationListener> xListener(
+ new comphelper::ConfigurationListener(aRandomPath));
+ xListener->dispose();
+ }
+
+ // test some changes
+ {
+ rtl::Reference<comphelper::ConfigurationListener> xListener(
+ new comphelper::ConfigurationListener(aRandomPath));
+
+ comphelper::ConfigurationListenerProperty<bool> aSetting(xListener, "AutoRedraw");
+ CPPUNIT_ASSERT_MESSAGE("check AutoRedraw defaults to true", aSetting.get());
+
+ // set to false
+ {
+ std::shared_ptr< comphelper::ConfigurationChanges > xChanges(
+ comphelper::ConfigurationChanges::create());
+ officecfg::Office::Math::View::AutoRedraw::set(false, xChanges);
+ xChanges->commit();
+ }
+ CPPUNIT_ASSERT_MESSAGE("listener failed to trigger", !aSetting.get());
+
+ // set to true
+ {
+ std::shared_ptr< comphelper::ConfigurationChanges > xChanges(
+ comphelper::ConfigurationChanges::create());
+ officecfg::Office::Math::View::AutoRedraw::set(true, xChanges);
+ xChanges->commit();
+ }
+ CPPUNIT_ASSERT_MESSAGE("listener failed to trigger", aSetting.get());
+
+ xListener->dispose();
+ }
+}
+
void Test::testRecursive()
{
bool destroyed = false;