Use ScopedConfigValue

These tests used ad-hoc structs for the required configuration values,
instead of direct use of officecfg headers.

Change-Id: I26353b0523d3607e84181de44a702ec007445c8d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198508
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski
2026-02-02 10:02:34 +01:00
parent a85beb8036
commit a99a6e7e17
3 changed files with 12 additions and 37 deletions
+4
View File
@@ -47,6 +47,10 @@ $(eval $(call gb_CppunitTest_set_include,sw_rtfimport,\
$$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_custom_headers,sw_rtfimport,\
officecfg/registry \
))
$(eval $(call gb_CppunitTest_use_api,sw_rtfimport,\
udkapi \
offapi \
+3 -12
View File
@@ -45,7 +45,8 @@
#include <tools/UnitConversion.hxx>
#include <rtl/ustring.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <comphelper/configuration.hxx>
#include <officecfg/Office/Linguistic.hxx>
#include <test/commontesttools.hxx>
namespace
{
@@ -865,17 +866,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo68291)
CPPUNIT_TEST_FIXTURE(Test, testTdf105511)
{
struct DefaultLocale : public comphelper::ConfigurationProperty<DefaultLocale, OUString>
{
static OUString path()
{
return u"/org.openoffice.Office.Linguistic/General/DefaultLocale"_ustr;
}
~DefaultLocale() = delete;
};
auto batch = comphelper::ConfigurationChanges::create();
DefaultLocale::set(u"ru-RU"_ustr, batch);
batch->commit();
ScopedConfigValue<officecfg::Office::Linguistic::General::DefaultLocale> aCfg(u"ru-RU"_ustr);
createSwDoc("tdf105511.rtf");
getParagraph(1, u"\u0418\u043C\u044F"_ustr);
}
+5 -25
View File
@@ -17,7 +17,6 @@
#include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/text/XTextTable.hpp>
#include <comphelper/propertysequence.hxx>
#include <comphelper/configuration.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <vcl/scheduler.hxx>
#include <vcl/settings.hxx>
@@ -36,6 +35,8 @@
#include <IDocumentLayoutAccess.hxx>
#include <redline.hxx>
#include <svx/svxids.hrc>
#include <officecfg/Office/Compatibility.hxx>
#include <test/commontesttools.hxx>
/// Second set of tests asserting the behavior of Writer user interface shells.
class SwUiWriterTest5 : public SwModelTestBase
@@ -1768,30 +1769,9 @@ static uno::Reference<text::XTextRange> getAssociatedTextRange(uno::Any object)
CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf123218)
{
struct ReverseXAxisOrientationDoughnutChart
: public comphelper::ConfigurationProperty<ReverseXAxisOrientationDoughnutChart, bool>
{
static OUString path()
{
return u"/org.openoffice.Office.Compatibility/View/ReverseXAxisOrientationDoughnutChart"_ustr;
}
~ReverseXAxisOrientationDoughnutChart() = delete;
};
struct ClockwisePieChartDirection
: public comphelper::ConfigurationProperty<ClockwisePieChartDirection, bool>
{
static OUString path()
{
return u"/org.openoffice.Office.Compatibility/View/ClockwisePieChartDirection"_ustr;
}
~ClockwisePieChartDirection() = delete;
};
auto batch = comphelper::ConfigurationChanges::create();
ReverseXAxisOrientationDoughnutChart::set(false, batch);
ClockwisePieChartDirection::set(true, batch);
batch->commit();
using CompatViewCfg = officecfg::Office::Compatibility::View;
ScopedConfigValue<CompatViewCfg::ReverseXAxisOrientationDoughnutChart> aCfg1(false);
ScopedConfigValue<CompatViewCfg::ClockwisePieChartDirection> aCfg2(true);
createSwDoc();