diff --git a/src/plasma/tests/CMakeLists.txt b/src/plasma/tests/CMakeLists.txt index c83d26e91..df1dfb718 100644 --- a/src/plasma/tests/CMakeLists.txt +++ b/src/plasma/tests/CMakeLists.txt @@ -1 +1,2 @@ add_subdirectory(kplugins) +add_subdirectory(dpi) diff --git a/src/plasma/tests/dpi/CMakeLists.txt b/src/plasma/tests/dpi/CMakeLists.txt new file mode 100644 index 000000000..03931f694 --- /dev/null +++ b/src/plasma/tests/dpi/CMakeLists.txt @@ -0,0 +1,13 @@ +project("dpitest") + +add_executable(dpitest + main.cpp + dpitest.cpp +) + +target_link_libraries(dpitest KF5::Plasma KF5::I18n Qt5::Gui) + +message("INSTALL_TARGETS_DEFAULT_ARGS ${INSTALL_TARGETS_DEFAULT_ARGS}") + +install(TARGETS dpitest ${INSTALL_TARGETS_DEFAULT_ARGS}) + diff --git a/src/plasma/tests/dpi/dpitest.cpp b/src/plasma/tests/dpi/dpitest.cpp new file mode 100644 index 000000000..5c9137119 --- /dev/null +++ b/src/plasma/tests/dpi/dpitest.cpp @@ -0,0 +1,63 @@ +/****************************************************************************** +* Copyright 2013 Sebastian Kügler * +* * +* 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 "dpitest.h" + +#include + +#include + +#include +#include +#include +#include +#include + + +namespace Plasma +{ +class DPITestPrivate { +public: + QString pluginName; + QCommandLineParser *parser; +}; + +DPITest::DPITest(int& argc, char** argv, QCommandLineParser *parser) : + QApplication(argc, argv) +{ + d = new DPITestPrivate; + d->parser = parser; + QTimer::singleShot(0, this, SLOT(runMain())); +} + +DPITest::~DPITest() +{ + delete d; +} + +void DPITest::runMain() +{ + qDebug() << "DPI test runs: "; + exit(0); + return; +} + +} + +#include "moc_dpitest.cpp" diff --git a/src/plasma/tests/dpi/dpitest.h b/src/plasma/tests/dpi/dpitest.h new file mode 100644 index 000000000..a15a13fe6 --- /dev/null +++ b/src/plasma/tests/dpi/dpitest.h @@ -0,0 +1,50 @@ +/****************************************************************************** +* Copyright 2012 Sebastian Kügler * +* * +* 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. * +*******************************************************************************/ + +#ifndef PLUGINTEST_H +#define PLUGINTEST_H + +#include +#include + +class QCommandLineParser; + +namespace Plasma +{ + +class DPITestPrivate; + +class DPITest : public QApplication +{ + Q_OBJECT + + public: + DPITest(int& argc, char** argv, QCommandLineParser *parser); + virtual ~DPITest(); + + public Q_SLOTS: + void runMain(); + + private: + DPITestPrivate* d; +}; + +} + +#endif diff --git a/src/plasma/tests/dpi/main.cpp b/src/plasma/tests/dpi/main.cpp new file mode 100644 index 000000000..6767b2dd3 --- /dev/null +++ b/src/plasma/tests/dpi/main.cpp @@ -0,0 +1,46 @@ +/* + * Copyright 2008 Aaron Seigo + * Copyright 2013 Sebastian Kügler + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2, + * or (at your option) any later version. + * + * This program 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 General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include +#include +#include +#include + +#include + +#include "dpitest.h" + +int main(int argc, char **argv) +{ + QCommandLineParser *parser = new QCommandLineParser; + Plasma::DPITest app(argc, argv, parser); + + const QString description = i18n("DPI test app"); + const char version[] = "2.0"; + + app.setApplicationVersion(version); + parser->addVersionOption(); + parser->setApplicationDescription(description); + + parser->addOption(QCommandLineOption(QStringList() << "s" << "show", i18nc("Do not translate ", "Show icon sizes"), "name")); + + return app.exec(); +} +