diff options
Diffstat (limited to 'autotests/kconfig_compiler')
-rw-r--r-- | autotests/kconfig_compiler/CMakeLists.txt | 11 | ||||
-rw-r--r-- | autotests/kconfig_compiler/kconfigcompiler_test.cpp | 2 | ||||
-rw-r--r-- | autotests/kconfig_compiler/test13.cpp.ref | 34 | ||||
-rw-r--r-- | autotests/kconfig_compiler/test13.h.ref | 70 | ||||
-rw-r--r-- | autotests/kconfig_compiler/test13.kcfg | 11 | ||||
-rw-r--r-- | autotests/kconfig_compiler/test13.kcfgc | 3 | ||||
-rw-r--r-- | autotests/kconfig_compiler/test13main.cpp | 28 | ||||
-rw-r--r-- | autotests/kconfig_compiler/test_signal.cpp.ref | 11 | ||||
-rw-r--r-- | autotests/kconfig_compiler/test_signal.h.ref | 18 |
9 files changed, 173 insertions, 15 deletions
diff --git a/autotests/kconfig_compiler/CMakeLists.txt b/autotests/kconfig_compiler/CMakeLists.txt index 0cca6052..5aa960ae 100644 --- a/autotests/kconfig_compiler/CMakeLists.txt +++ b/autotests/kconfig_compiler/CMakeLists.txt @@ -192,6 +192,17 @@ target_link_libraries(test12 KF5::ConfigGui) ########### next target ############### +set(test13_SRCS test13main.cpp ) + +gen_kcfg_test_source(test13 test13_SRCS) + +add_executable(test13 ${test13_SRCS}) +ecm_mark_as_test(test13) +target_link_libraries(test13 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 43623cef..aaf2d025 100644 --- a/autotests/kconfig_compiler/kconfigcompiler_test.cpp +++ b/autotests/kconfig_compiler/kconfigcompiler_test.cpp @@ -43,6 +43,7 @@ static CompilerTestSet testCases = { "test11.h", "test11.cpp", "test11a.h", "test11a.cpp", "test12.h", "test12.cpp", + "test13.h", "test13.cpp", "test_dpointer.cpp", "test_dpointer.h", "test_signal.cpp", "test_signal.h", "test_qdebugcategory.cpp", "test_qdebugcategory.h", @@ -63,6 +64,7 @@ static CompilerTestSet testCasesToRun = { "test10", "test11", "test12", + "test13", "test_dpointer", "test_signal", "test_qdebugcategory", diff --git a/autotests/kconfig_compiler/test13.cpp.ref b/autotests/kconfig_compiler/test13.cpp.ref new file mode 100644 index 00000000..4eac1034 --- /dev/null +++ b/autotests/kconfig_compiler/test13.cpp.ref @@ -0,0 +1,34 @@ +// This file is generated by kconfig_compiler_kf5 from test13.kcfg. +// All changes you do to this file will be lost. + +#include "test13.h" + +Test13::Test13( ) + : KConfigSkeleton( QLatin1String( "muondatasourcesrc" ) ) +{ + KConfigCompilerSignallingItem::NotifyFunction notifyFunction = static_cast<KConfigCompilerSignallingItem::NotifyFunction>(&Test13::itemChanged); + + setCurrentGroup( QLatin1String( "kamoso" ) ); + + KConfigSkeleton::ItemUrl *itemPicturesDir; + itemPicturesDir = new KConfigSkeleton::ItemUrl( currentGroup(), QLatin1String( "picturesDir" ), mPicturesDir ); + addItem( itemPicturesDir, QLatin1String( "picturesDir" ) ); + KConfigCompilerSignallingItem *itemBrightness; + itemBrightness = new KConfigCompilerSignallingItem(new KConfigSkeleton::ItemDouble( currentGroup(), QLatin1String( "brightness" ), mBrightness ), this, notifyFunction, signalBrightnessChanged); + addItem( itemBrightness, QLatin1String( "brightness" ) ); +} + +Test13::~Test13() +{ +} + + +void Test13::itemChanged(quint64 flags) { + + if ( flags & signalBrightnessChanged ) { + Q_EMIT brightnessChanged(); + } +} + +#include "test13.moc" + diff --git a/autotests/kconfig_compiler/test13.h.ref b/autotests/kconfig_compiler/test13.h.ref new file mode 100644 index 00000000..0636ad2f --- /dev/null +++ b/autotests/kconfig_compiler/test13.h.ref @@ -0,0 +1,70 @@ +// This file is generated by kconfig_compiler_kf5 from test13.kcfg. +// All changes you do to this file will be lost. +#ifndef TEST13_H +#define TEST13_H + +#include <qglobal.h> +#include <kconfigskeleton.h> +#include <QCoreApplication> +#include <QDebug> + +class Test13 : public KConfigSkeleton +{ + Q_OBJECT + public: + + Test13( ); + ~Test13(); + + + Q_PROPERTY(QUrl picturesDir READ picturesDir CONSTANT) + /** + Get picturesDir + */ + QUrl picturesDir() const + { + return mPicturesDir; + } + + /** + Set brightness + */ + void setBrightness( double v ) + { + if (v != mBrightness && !isImmutable( QString::fromLatin1( "brightness" ) )) { + mBrightness = v; + Q_EMIT brightnessChanged(); + } + } + + Q_PROPERTY(double brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged) + /** + Get brightness + */ + double brightness() const + { + return mBrightness; + } + + + enum { + signalBrightnessChanged = 0x1 + }; + + Q_SIGNALS: + void brightnessChanged(); + + private: + void itemChanged(quint64 flags); + + protected: + + // kamoso + QUrl mPicturesDir; + double mBrightness; + + private: +}; + +#endif + diff --git a/autotests/kconfig_compiler/test13.kcfg b/autotests/kconfig_compiler/test13.kcfg new file mode 100644 index 00000000..c4d36350 --- /dev/null +++ b/autotests/kconfig_compiler/test13.kcfg @@ -0,0 +1,11 @@ +<?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="muondatasourcesrc"/> + <group name="kamoso"> + <entry name="picturesDir" type="Url" /> + <entry name="brightness" type="double" /> + </group> +</kcfg> diff --git a/autotests/kconfig_compiler/test13.kcfgc b/autotests/kconfig_compiler/test13.kcfgc new file mode 100644 index 00000000..340b8cae --- /dev/null +++ b/autotests/kconfig_compiler/test13.kcfgc @@ -0,0 +1,3 @@ +ClassName=Test13 +GenerateProperties=true +Mutators=brightness diff --git a/autotests/kconfig_compiler/test13main.cpp b/autotests/kconfig_compiler/test13main.cpp new file mode 100644 index 00000000..e732c17c --- /dev/null +++ b/autotests/kconfig_compiler/test13main.cpp @@ -0,0 +1,28 @@ +/* +Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ +#include "test13.h" + +int main(int, char **) +{ + Test13 *t = new Test13(); + delete t; + return 0; +} diff --git a/autotests/kconfig_compiler/test_signal.cpp.ref b/autotests/kconfig_compiler/test_signal.cpp.ref index 58e73efd..6faf8bd1 100644 --- a/autotests/kconfig_compiler/test_signal.cpp.ref +++ b/autotests/kconfig_compiler/test_signal.cpp.ref @@ -61,18 +61,17 @@ bool TestSignal::usrWriteConfig() const bool res = KConfigSkeleton::usrWriteConfig(); if (!res) return false; - if ( mSettingsChanged & signalEmoticonSettingsChanged ) - emit emoticonSettingsChanged(); - - if ( mSettingsChanged & signalStyleChanged ) - emit styleChanged(mStylePath, mStyleCSSVariant); - + if ( mSettingsChanged & signalEmoticonSettingsChanged ) + Q_EMIT emoticonSettingsChanged(); + if ( mSettingsChanged & signalStyleChanged ) + Q_EMIT styleChanged(mStylePath, mStyleCSSVariant); mSettingsChanged = 0; return true; } void TestSignal::itemChanged(quint64 flags) { mSettingsChanged |= flags; + } #include "test_signal.moc" diff --git a/autotests/kconfig_compiler/test_signal.h.ref b/autotests/kconfig_compiler/test_signal.h.ref index 19b8b400..e9f9c94c 100644 --- a/autotests/kconfig_compiler/test_signal.h.ref +++ b/autotests/kconfig_compiler/test_signal.h.ref @@ -12,11 +12,6 @@ class TestSignal : public KConfigSkeleton Q_OBJECT public: - enum { - signalEmoticonSettingsChanged = 0x1, - signalStyleChanged = 0x2 - }; - static TestSignal *self(); ~TestSignal(); @@ -26,7 +21,7 @@ class TestSignal : public KConfigSkeleton static void setEmoticonTheme( const QString & v ) { - if (!self()->isImmutable( QString::fromLatin1( "emoticonTheme" ) )) { + if (v != self()->mEmoticonTheme && !self()->isImmutable( QString::fromLatin1( "emoticonTheme" ) )) { self()->mEmoticonTheme = v; self()->mSettingsChanged |= signalEmoticonSettingsChanged; } @@ -47,7 +42,7 @@ class TestSignal : public KConfigSkeleton static void setUseEmoticon( bool v ) { - if (!self()->isImmutable( QString::fromLatin1( "useEmoticon" ) )) { + if (v != self()->mUseEmoticon && !self()->isImmutable( QString::fromLatin1( "useEmoticon" ) )) { self()->mUseEmoticon = v; self()->mSettingsChanged |= signalEmoticonSettingsChanged; } @@ -68,7 +63,7 @@ class TestSignal : public KConfigSkeleton static void setEmoticonRequireSpace( bool v ) { - if (!self()->isImmutable( QString::fromLatin1( "emoticonRequireSpace" ) )) { + if (v != self()->mEmoticonRequireSpace && !self()->isImmutable( QString::fromLatin1( "emoticonRequireSpace" ) )) { self()->mEmoticonRequireSpace = v; self()->mSettingsChanged |= signalEmoticonSettingsChanged; } @@ -89,7 +84,7 @@ class TestSignal : public KConfigSkeleton static void setStylePath( const QString & v ) { - if (!self()->isImmutable( QString::fromLatin1( "stylePath" ) )) { + if (v != self()->mStylePath && !self()->isImmutable( QString::fromLatin1( "stylePath" ) )) { self()->mStylePath = v; self()->mSettingsChanged |= signalStyleChanged; } @@ -124,6 +119,11 @@ class TestSignal : public KConfigSkeleton } + enum { + signalEmoticonSettingsChanged = 0x1, + signalStyleChanged = 0x2 + }; + Q_SIGNALS: void emoticonSettingsChanged(); |