diff options
author | Friedrich W. H. Kossebau <kossebau@kde.org> | 2022-02-09 13:55:14 +0100 |
---|---|---|
committer | Friedrich W. H. Kossebau <kossebau@kde.org> | 2022-02-18 22:24:41 +0000 |
commit | 3583e0d2ed951365777122ae4b2ab4641125f756 (patch) | |
tree | 8a4731ec1d0fc3f098e48994575d271711879898 /autotests | |
parent | 86adf52dfce9c1e8a3d0be54d159918c01ea919c (diff) | |
download | kconfig-3583e0d2ed951365777122ae4b2ab4641125f756.tar.gz kconfig-3583e0d2ed951365777122ae4b2ab4641125f756.tar.bz2 |
KConfigCompiler: support ItemAccessors=true with signalling items
Diffstat (limited to 'autotests')
3 files changed, 17 insertions, 0 deletions
diff --git a/autotests/kconfig_compiler/CMakeLists.txt b/autotests/kconfig_compiler/CMakeLists.txt index 5cbf2e44..2598e4a1 100644 --- a/autotests/kconfig_compiler/CMakeLists.txt +++ b/autotests/kconfig_compiler/CMakeLists.txt @@ -231,6 +231,7 @@ gen_kcfg_test_source(signals_test_singleton kconfigcompiler_test_signals_SRCS GE gen_kcfg_test_source(signals_test_no_singleton kconfigcompiler_test_signals_SRCS GENERATE_MOC) gen_kcfg_test_source(signals_test_singleton_dpointer kconfigcompiler_test_signals_SRCS GENERATE_MOC) gen_kcfg_test_source(signals_test_no_singleton_dpointer kconfigcompiler_test_signals_SRCS GENERATE_MOC) +gen_kcfg_test_source(signals_test_singleton_itemaccessors kconfigcompiler_test_signals_SRCS GENERATE_MOC) ecm_add_test(${kconfigcompiler_test_signals_SRCS} TEST_NAME kconfigcompiler-signals-test diff --git a/autotests/kconfig_compiler/kconfigcompiler_test_signals.cpp b/autotests/kconfig_compiler/kconfigcompiler_test_signals.cpp index f493d35f..64eb2ca7 100644 --- a/autotests/kconfig_compiler/kconfigcompiler_test_signals.cpp +++ b/autotests/kconfig_compiler/kconfigcompiler_test_signals.cpp @@ -8,6 +8,7 @@ #include "signals_test_no_singleton_dpointer.h" #include "signals_test_singleton.h" #include "signals_test_singleton_dpointer.h" +#include "signals_test_singleton_itemaccessors.h" #include <QDebug> #include <QFileInfo> #include <QSharedPointer> @@ -40,15 +41,18 @@ void KConfigCompiler_Test_Signals::initTestCase() QTemporaryFile *tempFile2 = new QTemporaryFile(this); QTemporaryFile *tempFile3 = new QTemporaryFile(this); QTemporaryFile *tempFile4 = new QTemporaryFile(this); + QTemporaryFile *tempFile5 = new QTemporaryFile(this); QVERIFY(tempFile1->open()); QVERIFY(tempFile2->open()); QVERIFY(tempFile3->open()); QVERIFY(tempFile4->open()); + QVERIFY(tempFile5->open()); SignalsTestSingleton::instance(QFileInfo(*tempFile1).absoluteFilePath()); SignalsTestSingletonDpointer::instance(QFileInfo(*tempFile2).absoluteFilePath()); noSingleton = new SignalsTestNoSingleton(KSharedConfig::openConfig(QFileInfo(*tempFile3).absoluteFilePath(), KConfig::SimpleConfig)); noSingletonDpointer = new SignalsTestNoSingletonDpointer(KSharedConfig::openConfig(QFileInfo(*tempFile4).absoluteFilePath(), KConfig::SimpleConfig)); + SignalsTestSingletonItemAccessors::instance(QFileInfo(*tempFile5).absoluteFilePath()); } void KConfigCompiler_Test_Signals::cleanupTestCase() @@ -58,6 +62,7 @@ void KConfigCompiler_Test_Signals::cleanupTestCase() delete noSingletonDpointer; delete SignalsTestSingleton::self(); delete SignalsTestSingletonDpointer::self(); + delete SignalsTestSingletonItemAccessors::self(); } struct TestSettersArg { @@ -96,6 +101,7 @@ void KConfigCompiler_Test_Signals::testSetters_data() QTest::newRow("singleton dpointer") << TestSettersArg(SignalsTestSingletonDpointer::self()); QTest::newRow("non-singleton") << TestSettersArg(noSingleton); QTest::newRow("non-singleton dpointer") << TestSettersArg(noSingleton); + QTest::newRow("singleton itemaccessors") << TestSettersArg(SignalsTestSingletonItemAccessors::self()); } /** Ensure that a signal is emitted whenever the data is changed by using the generated setters */ @@ -154,6 +160,7 @@ void KConfigCompiler_Test_Signals::testSetProperty_data() QTest::newRow("singleton dpointer") << static_cast<KCoreConfigSkeleton *>(SignalsTestSingletonDpointer::self()); QTest::newRow("non-singleton") << static_cast<KCoreConfigSkeleton *>(noSingleton); QTest::newRow("non-singleton dpointer") << static_cast<KCoreConfigSkeleton *>(noSingletonDpointer); + QTest::newRow("singleton itemaccessors") << static_cast<KCoreConfigSkeleton *>(SignalsTestSingletonItemAccessors::self()); } /** Test that the signal is emitted when modifying the values using the underlying KConfigSkeletonItem (bypassing the setters) */ diff --git a/autotests/kconfig_compiler/signals_test_singleton_itemaccessors.kcfgc b/autotests/kconfig_compiler/signals_test_singleton_itemaccessors.kcfgc new file mode 100644 index 00000000..c71cca8e --- /dev/null +++ b/autotests/kconfig_compiler/signals_test_singleton_itemaccessors.kcfgc @@ -0,0 +1,9 @@ +File=signals_test.kcfg +ClassName=SignalsTestSingletonItemAccessors +Singleton=true +Mutators=true +MemberVariables=private +GlobalEnums=false +UseEnumTypes=false +ItemAccessors=true +DefaultValueGetters=true |