Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cfg/kde.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<define name="KDE_PACKED" value=""/>
<define name="KDE_VERSION" value="KDE_MAKE_VERSION(KDE_VERSION_MAJOR,KDE_VERSION_MINOR,KDE_VERSION_RELEASE)"/>
<define name="KDE_WEAK_SYMBOL" value=""/>
<define name="K_PLUGIN_CLASS_WITH_JSON(class_name, json_name)" value=""/>
<define name="K_PLUGIN_CLASS(class_name)" value=""/>
<define name="K_PLUGIN_FACTORY(class_name, ...)" value=""/>
<define name="K_PLUGIN_FACTORY_WITH_JSON(class_name, json_name, ...)" value=""/>
<define name="EXPORT_KONTACT_PLUGIN_WITH_JSON(class_name, json_name)" value=""/>
<!-- ########## KDE Allocation / Deallocation ########## -->
<!-- ########## KDE Functions ########## -->
<!-- template<typename T > T KConfigGroup::readEntry ( const QString & key, const T & aDefault ) const -->
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ if (BUILD_TESTS)
add_cfg(gnu.c ADD_LIBRARY posix)
add_cfg(googletest.cpp)
add_cfg(gtk.c)
add_cfg(kde.cpp)
add_cfg(kde.cpp ADD_LIBRARY qt)
add_cfg(libcurl.c)
add_cfg(libsigc++.cpp)
add_cfg(lua.c)
Expand Down
45 changes: 44 additions & 1 deletion test/cfg/kde.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Test library configuration for kde.cfg
//
// Usage:
// $ cppcheck --check-library --library=kde --enable=style,information --inconclusive --error-exitcode=1 --inline-suppr test/cfg/kde.cpp
// $ cppcheck --check-library --library=kde --library=qt --enable=style,information --inconclusive --error-exitcode=1 --inline-suppr test/cfg/kde.cpp
// =>
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
//
Expand All @@ -11,6 +11,7 @@
#include <KDE/KGlobal>
#include <KDE/KConfigGroup>
#include <klocalizedstring.h>
#include <kpluginfactory.h>

class k_global_static_testclass1 {};
K_GLOBAL_STATIC(k_global_static_testclass1, k_global_static_testinstance1);
Expand Down Expand Up @@ -41,3 +42,45 @@ void i18n_test()
(void)xi18nc("Text", "Context");
(void)ki18nc("Text", "Context");
}

class PluginWithoutMetaData : public QObject
{
Q_OBJECT
public:
// Add a default arg to make sure we do not get an ambiguity compiler error
explicit PluginWithoutMetaData(const QObject *, const QVariantList &args = {})
: QObject()
{
Q_UNUSED(args)
};
};

K_PLUGIN_CLASS(PluginWithoutMetaData)

class StaticSimplePluginClass : public QObject
{
Q_OBJECT

public:
// Next to the assertion below, ensure that we have no ambiguity!
explicit StaticSimplePluginClass(QObject *parent, const QString &data = {})
: QObject(parent)
{
// We have added a default arg, but KPluginFactory should still provide the valid metadata instead of the default one
data = QString("foo");
}
};
K_PLUGIN_CLASS_WITH_JSON(StaticSimplePluginClass, "data/jsonplugin.json")

class ClipboardPlugin : public Purpose::PluginBase
{
Q_OBJECT
public:
using PluginBase::PluginBase;
Purpose::Job *createJob() const override
{
return new ClipboardJob(nullptr);
}
};

K_PLUGIN_FACTORY_WITH_JSON(Clipboard, "clipboardplugin.json", foo)
2 changes: 1 addition & 1 deletion test/cfg/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ function check_file {
kde.cpp)
# TODO: "kde-4config" is no longer commonly available in recent distros
#kde_fn
"${CPPCHECK}" "${CPPCHECK_OPT[@]}" --library="$lib" "${DIR}""$f"
"${CPPCHECK}" "${CPPCHECK_OPT[@]}" --library="$lib" --library=qt "${DIR}""$f"
;;
libcurl.c)
libcurl_fn
Expand Down
Loading