aboutsummaryrefslogtreecommitdiff
path: root/autotests
diff options
context:
space:
mode:
Diffstat (limited to 'autotests')
-rw-r--r--autotests/kconfig_compiler/CMakeLists.txt10
-rw-r--r--autotests/kconfig_compiler/kconfigcompiler_test.cpp2
-rw-r--r--autotests/kconfig_compiler/test_subgroups.cpp.ref47
-rw-r--r--autotests/kconfig_compiler/test_subgroups.h.ref102
-rw-r--r--autotests/kconfig_compiler/test_subgroups.kcfg31
-rw-r--r--autotests/kconfig_compiler/test_subgroups.kcfgc3
-rw-r--r--autotests/kconfig_compiler/test_subgroups_main.cpp32
7 files changed, 227 insertions, 0 deletions
diff --git a/autotests/kconfig_compiler/CMakeLists.txt b/autotests/kconfig_compiler/CMakeLists.txt
index 2b31a4da..2a4b343b 100644
--- a/autotests/kconfig_compiler/CMakeLists.txt
+++ b/autotests/kconfig_compiler/CMakeLists.txt
@@ -181,6 +181,16 @@ target_link_libraries(test_emptyentries KF5::ConfigGui)
########### next target ###############
+set(test_subgroups_SRCS test_subgroups_main.cpp )
+
+gen_kcfg_test_source(test_subgroups test_subgroups_SRCS GENERATE_MOC)
+
+ecm_add_test(TEST_NAME test_subgroups ${test_subgroups_SRCS})
+target_link_libraries(test_subgroups KF5::ConfigGui)
+
+
+########### next target ###############
+
set(test_dpointer_SRCS test_dpointer_main.cpp )
gen_kcfg_test_source(test_dpointer test_dpointer_SRCS)
diff --git a/autotests/kconfig_compiler/kconfigcompiler_test.cpp b/autotests/kconfig_compiler/kconfigcompiler_test.cpp
index dc848f9d..bb4dd7c0 100644
--- a/autotests/kconfig_compiler/kconfigcompiler_test.cpp
+++ b/autotests/kconfig_compiler/kconfigcompiler_test.cpp
@@ -48,6 +48,7 @@ static CompilerTestSet testCases = {
"test_emptyentries.cpp", "test_emptyentries.h",
"test_properties_minmax.cpp", "test_properties_minmax.h",
"test_param_minmax.cpp", "test_param_minmax.h",
+ "test_subgroups.cpp", "test_subgroups.h",
nullptr
};
@@ -75,6 +76,7 @@ static CompilerTestSet testCasesToRun = {
"test_emptyentries",
"test_properties_minmax",
"test_param_minmax",
+ "test_subgroups",
nullptr
};
diff --git a/autotests/kconfig_compiler/test_subgroups.cpp.ref b/autotests/kconfig_compiler/test_subgroups.cpp.ref
new file mode 100644
index 00000000..0c16742a
--- /dev/null
+++ b/autotests/kconfig_compiler/test_subgroups.cpp.ref
@@ -0,0 +1,47 @@
+// This file is generated by kconfig_compiler_kf5 from test_subgroups.kcfg.
+// All changes you do to this file will be lost.
+
+#include "test_subgroups.h"
+
+TestSubgroups::TestSubgroups( const QString & GeneralGroup, const QString & SubGroup, const QString & AnotherSubGroup )
+ : KConfigSkeleton( QStringLiteral( "kconfig_compiler_kf5_test_rc" ) )
+ , mParamGeneralGroup(GeneralGroup)
+ , mParamSubGroup(SubGroup)
+ , mParamAnotherSubGroup(AnotherSubGroup)
+{
+ KConfigGroup cgGeneralGroup(this->config(), QStringLiteral( "%1" ).arg( mParamGeneralGroup ));
+ KConfigGroup cgSubGroup = cgGeneralGroup.group(QStringLiteral( "%1" ).arg( mParamSubGroup ));
+ KConfigSkeleton::ItemBool *itemFoo;
+ itemFoo = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Foo" ), mFoo, true );
+ itemFoo->setWriteFlags(KConfigBase::Notify);
+ itemFoo->setGroup(cgSubGroup);
+ addItem( itemFoo, QStringLiteral( "Foo" ) );
+
+ KConfigGroup cgother = cgGeneralGroup.group(QStringLiteral( "other" ));
+ KConfigSkeleton::ItemInt *itemBar;
+ itemBar = new KConfigSkeleton::ItemInt( currentGroup(), QStringLiteral( "Bar" ), mBar, 42 );
+ itemBar->setWriteFlags(KConfigBase::Notify);
+ itemBar->setGroup(cgother);
+ addItem( itemBar, QStringLiteral( "Bar" ) );
+
+ KConfigGroup cgParentGroup(this->config(), QStringLiteral( "ParentGroup" ));
+ KConfigGroup cgAnotherSubGroup = cgParentGroup.group(QStringLiteral( "%1" ).arg( mParamAnotherSubGroup ));
+ KConfigSkeleton::ItemBool *itemBaz;
+ itemBaz = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Baz" ), mBaz, true );
+ itemBaz->setWriteFlags(KConfigBase::Notify);
+ itemBaz->setGroup(cgAnotherSubGroup);
+ addItem( itemBaz, QStringLiteral( "Baz" ) );
+
+ KConfigGroup cgSimpleParentGroup(this->config(), QStringLiteral( "SimpleParentGroup" ));
+ KConfigGroup cgSimpleGroup = cgSimpleParentGroup.group(QStringLiteral( "SimpleGroup" ));
+ KConfigSkeleton::ItemBool *itemFoobar;
+ itemFoobar = new KConfigSkeleton::ItemBool( currentGroup(), QStringLiteral( "Foobar" ), mFoobar, true );
+ itemFoobar->setWriteFlags(KConfigBase::Notify);
+ itemFoobar->setGroup(cgSimpleGroup);
+ addItem( itemFoobar, QStringLiteral( "Foobar" ) );
+}
+
+TestSubgroups::~TestSubgroups()
+{
+}
+
diff --git a/autotests/kconfig_compiler/test_subgroups.h.ref b/autotests/kconfig_compiler/test_subgroups.h.ref
new file mode 100644
index 00000000..11665710
--- /dev/null
+++ b/autotests/kconfig_compiler/test_subgroups.h.ref
@@ -0,0 +1,102 @@
+// This file is generated by kconfig_compiler_kf5 from test_subgroups.kcfg.
+// All changes you do to this file will be lost.
+#ifndef TESTSUBGROUPS_H
+#define TESTSUBGROUPS_H
+
+#include <kconfigskeleton.h>
+#include <QCoreApplication>
+#include <QDebug>
+
+class TestSubgroups : public KConfigSkeleton
+{
+ public:
+
+ TestSubgroups( const QString & GeneralGroup, const QString & SubGroup, const QString & AnotherSubGroup );
+ ~TestSubgroups();
+
+ /**
+ Get Foo
+ */
+ bool foo() const
+ {
+ return mFoo;
+ }
+
+ /**
+ Is Foo Immutable
+ */
+ bool isFooImmutable() const
+ {
+ return isImmutable( QStringLiteral( "Foo" ) );
+ }
+
+ /**
+ Get Bar
+ */
+ int bar() const
+ {
+ return mBar;
+ }
+
+ /**
+ Is Bar Immutable
+ */
+ bool isBarImmutable() const
+ {
+ return isImmutable( QStringLiteral( "Bar" ) );
+ }
+
+ /**
+ Get Baz
+ */
+ bool baz() const
+ {
+ return mBaz;
+ }
+
+ /**
+ Is Baz Immutable
+ */
+ bool isBazImmutable() const
+ {
+ return isImmutable( QStringLiteral( "Baz" ) );
+ }
+
+ /**
+ Get Foobar
+ */
+ bool foobar() const
+ {
+ return mFoobar;
+ }
+
+ /**
+ Is Foobar Immutable
+ */
+ bool isFoobarImmutable() const
+ {
+ return isImmutable( QStringLiteral( "Foobar" ) );
+ }
+
+ protected:
+ QString mParamGeneralGroup;
+ QString mParamSubGroup;
+ QString mParamAnotherSubGroup;
+
+ // $(SubGroup)
+ bool mFoo;
+
+ // other
+ int mBar;
+
+ // $(AnotherSubGroup)
+ bool mBaz;
+
+ // SimpleGroup
+ bool mFoobar;
+
+ private:
+};
+
+#endif
+
diff --git a/autotests/kconfig_compiler/test_subgroups.kcfg b/autotests/kconfig_compiler/test_subgroups.kcfg
new file mode 100644
index 00000000..aa4ef948
--- /dev/null
+++ b/autotests/kconfig_compiler/test_subgroups.kcfg
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
+ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
+ <kcfgfile name="kconfig_compiler_kf5_test_rc">
+ <parameter name="GeneralGroup" />
+ <parameter name="SubGroup"/>
+ <parameter name="AnotherSubGroup"/>
+ </kcfgfile>
+ <group name="$(SubGroup)" parentGroupName="$(GeneralGroup)">
+ <entry name="Foo" type="Bool">
+ <default>true</default>
+ </entry>
+ </group>
+ <group name="other" parentGroupName="$(GeneralGroup)">
+ <entry name="Bar" type="Int">
+ <default>42</default>
+ </entry>
+ </group>
+ <group name="$(AnotherSubGroup)" parentGroupName="ParentGroup">
+ <entry name="Baz" type="Bool">
+ <default>true</default>
+ </entry>
+ </group>
+ <group name="SimpleGroup" parentGroupName="SimpleParentGroup">
+ <entry name="Foobar" type="Bool">
+ <default>true</default>
+ </entry>
+ </group>
+</kcfg>
diff --git a/autotests/kconfig_compiler/test_subgroups.kcfgc b/autotests/kconfig_compiler/test_subgroups.kcfgc
new file mode 100644
index 00000000..971964b3
--- /dev/null
+++ b/autotests/kconfig_compiler/test_subgroups.kcfgc
@@ -0,0 +1,3 @@
+File=test_subgroups.kcfg
+ClassName=TestSubgroups
+Notifiers=true
diff --git a/autotests/kconfig_compiler/test_subgroups_main.cpp b/autotests/kconfig_compiler/test_subgroups_main.cpp
new file mode 100644
index 00000000..d034859c
--- /dev/null
+++ b/autotests/kconfig_compiler/test_subgroups_main.cpp
@@ -0,0 +1,32 @@
+/*
+ This file is part of KDE.
+
+ Copyright (C) 2020 Cyril Rossi <cyril.rossi@enioka.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "test_subgroups.h"
+#include <QGuiApplication>
+
+int main(int argc, char **argv)
+{
+ QGuiApplication app(argc, argv);
+ Q_UNUSED(app);
+ TestSubgroups *t = new TestSubgroups(QStringLiteral("General"), QStringLiteral("Sub"), QStringLiteral("AnotherSub"));
+ delete t;
+ return 0;
+}