summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorDhiraj Holden <dhiraj.holden@gmail.com>2022-01-28 22:36:39 -0500
committerStephan Bergmann <sbergman@redhat.com>2022-01-31 12:32:14 +0100
commit22c9ba31c6d455e5f1ddbf3f91e37fcb76140607 (patch)
tree31072e430422750d9e43e07931b22b365686c566 /sw
parent2174b56ffb5817e42c8b4f6891214fcb67c55b30 (diff)
tdf#46037 remove confighelper from uiwriter tests
Change-Id: I984d707e61d526791c60d57dd35727432f7f42bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129135 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx14
-rw-r--r--sw/qa/extras/uiwriter/uiwriter4.cxx24
-rw-r--r--sw/uiwriter_setup.mk4
3 files changed, 28 insertions, 14 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index f966efeeefeb..609db65392e7 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -79,7 +79,7 @@
#include <sfx2/docfilt.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/dispatch.hxx>
-#include <comphelper/configurationhelper.hxx>
+#include <comphelper/configuration.hxx>
#include <vcl/scheduler.hxx>
#include <config_features.h>
#include <config_fonts.h>
@@ -92,6 +92,7 @@
#include <unotxdoc.hxx>
#include <comphelper/processfactory.hxx>
#include <rootfrm.hxx>
+#include <officecfg/Office/Writer.hxx>
namespace
{
@@ -3351,17 +3352,22 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf90362)
SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
uno::Reference<uno::XComponentContext> xComponentContext(comphelper::getProcessComponentContext());
// Ensure correct initial setting
- comphelper::ConfigurationHelper::writeDirectKey(xComponentContext, "org.openoffice.Office.Writer/", "Cursor/Option", "IgnoreProtectedArea", css::uno::Any(false), comphelper::EConfigurationModes::Standard);
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(
+ comphelper::ConfigurationChanges::create(xComponentContext));
+ officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea::set(false, batch);
+ batch->commit();
// First check if the end of the second paragraph is indeed protected.
pWrtShell->EndPara();
pWrtShell->Down(/*bSelect=*/false);
CPPUNIT_ASSERT_EQUAL(true, pWrtShell->HasReadonlySel());
// Then enable ignoring of protected areas and make sure that this time the cursor is read-write.
- comphelper::ConfigurationHelper::writeDirectKey(xComponentContext, "org.openoffice.Office.Writer/", "Cursor/Option", "IgnoreProtectedArea", css::uno::Any(true), comphelper::EConfigurationModes::Standard);
+ officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea::set(true, batch);
+ batch->commit();
CPPUNIT_ASSERT_EQUAL(false, pWrtShell->HasReadonlySel());
// Clean up, otherwise following tests will have that option set
- comphelper::ConfigurationHelper::writeDirectKey(xComponentContext, "org.openoffice.Office.Writer/", "Cursor/Option", "IgnoreProtectedArea", css::uno::Any(false), comphelper::EConfigurationModes::Standard);
+ officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea::set(false, batch);
+ batch->commit();
}
CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testUndoDelAsCharTdf107512)
diff --git a/sw/qa/extras/uiwriter/uiwriter4.cxx b/sw/qa/extras/uiwriter/uiwriter4.cxx
index 5e916b6a43a6..4ee3cfff78b0 100644
--- a/sw/qa/extras/uiwriter/uiwriter4.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter4.cxx
@@ -52,7 +52,7 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <sfx2/viewfrm.hxx>
#include <sfx2/dispatch.hxx>
-#include <comphelper/configurationhelper.hxx>
+#include <comphelper/configuration.hxx>
#include <editeng/unolingu.hxx>
#include <vcl/scheduler.hxx>
#include <config_fonts.h>
@@ -62,6 +62,7 @@
#include <unotxdoc.hxx>
#include <comphelper/processfactory.hxx>
#include <unotools/transliterationwrapper.hxx>
+#include <officecfg/Office/Writer.hxx>
namespace
{
@@ -1670,9 +1671,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf105625)
uno::Reference<uno::XComponentContext> xComponentContext(
comphelper::getProcessComponentContext());
// Ensure correct initial setting
- comphelper::ConfigurationHelper::writeDirectKey(
- xComponentContext, "org.openoffice.Office.Writer/", "Cursor/Option", "IgnoreProtectedArea",
- css::uno::Any(false), comphelper::EConfigurationModes::Standard);
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(
+ comphelper::ConfigurationChanges::create(xComponentContext));
+ officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea::set(false, batch);
+ batch->commit();
// We should be able to edit at positions adjacent to fields.
// Check if the start and the end of the 1st paragraph are not protected
// (they are adjacent to FORMCHECKBOX)
@@ -1705,9 +1707,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf125151_protected)
uno::Reference<uno::XComponentContext> xComponentContext(
comphelper::getProcessComponentContext());
// Ensure correct initial setting
- comphelper::ConfigurationHelper::writeDirectKey(
- xComponentContext, "org.openoffice.Office.Writer/", "Cursor/Option", "IgnoreProtectedArea",
- css::uno::Any(false), comphelper::EConfigurationModes::Standard);
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(
+ comphelper::ConfigurationChanges::create(xComponentContext));
+ officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea::set(false, batch);
+ batch->commit();
pWrtShell->Down(/*bSelect=*/false);
// The cursor moved inside of the FieldMark textbox.
CPPUNIT_ASSERT_EQUAL_MESSAGE("Readonly 1", false, pWrtShell->HasReadonlySel());
@@ -1724,9 +1727,10 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest4, testTdf125151_protectedB)
uno::Reference<uno::XComponentContext> xComponentContext(
comphelper::getProcessComponentContext());
// Ensure correct initial setting
- comphelper::ConfigurationHelper::writeDirectKey(
- xComponentContext, "org.openoffice.Office.Writer/", "Cursor/Option", "IgnoreProtectedArea",
- css::uno::Any(false), comphelper::EConfigurationModes::Standard);
+ std::shared_ptr<comphelper::ConfigurationChanges> batch(
+ comphelper::ConfigurationChanges::create(xComponentContext));
+ officecfg::Office::Writer::Cursor::Option::IgnoreProtectedArea::set(false, batch);
+ batch->commit();
// The cursor starts inside of the FieldMark textbox.
CPPUNIT_ASSERT_EQUAL_MESSAGE("Readonly 1", false, pWrtShell->HasReadonlySel());
// Move left to the start/definition of the textbox
diff --git a/sw/uiwriter_setup.mk b/sw/uiwriter_setup.mk
index a4def8e80120..c6b1d6417f24 100644
--- a/sw/uiwriter_setup.mk
+++ b/sw/uiwriter_setup.mk
@@ -51,6 +51,10 @@ $(eval $(call gb_CppunitTest_use_externals,sw_uiwriter$(1),\
libxml2 \
))
+$(eval $(call gb_CppunitTest_use_custom_headers,sw_uiwriter$(1),\
+ officecfg/registry \
+))
+
$(eval $(call gb_CppunitTest_set_include,sw_uiwriter$(1),\
-I$(SRCDIR)/sw/inc \
-I$(SRCDIR)/sw/source/core/inc \