one more iteration to try to fix tests on travis

This commit is contained in:
Evgenii Alekseev 2017-02-14 03:48:11 +03:00
parent ce09ab753b
commit 38c5589c10
11 changed files with 66 additions and 15 deletions

View File

@ -17,11 +17,17 @@ arch:
- cd awesome-widgets/build && cmake -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DCMAKE_BUILD_TYPE=Optimization -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_FUTURE=ON -DBUILD_TESTING=ON ../sources - cd awesome-widgets/build && cmake -DKDE_INSTALL_USE_QT_SYS_PATHS=ON -DCMAKE_BUILD_TYPE=Optimization -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_FUTURE=ON -DBUILD_TESTING=ON ../sources
- cd awesome-widgets/build && make - cd awesome-widgets/build && make
- cd awesome-widgets/build && xvfb-run make test || true - cd awesome-widgets/build && xvfb-run make test || true
- sleep 3
- cd awesome-widgets/build && xvfb-run ./test/awesomewidgets-test-extscript || true - cd awesome-widgets/build && xvfb-run ./test/awesomewidgets-test-extscript || true
- sleep 3
- cd awesome-widgets/build && xvfb-run ./test/awesomewidgets-test-extweather || true - cd awesome-widgets/build && xvfb-run ./test/awesomewidgets-test-extweather || true
- sleep 3
- cd awesome-widgets/build && xvfb-run ./test/awesomewidgets-test-playersource || true - cd awesome-widgets/build && xvfb-run ./test/awesomewidgets-test-playersource || true
- sleep 3
- cd awesome-widgets/build && xvfb-run ./test/awesomewidgets-test-awkeys || true - cd awesome-widgets/build && xvfb-run ./test/awesomewidgets-test-awkeys || true
- sleep 3
- cd awesome-widgets/build && xvfb-run ./test/awesomewidgets-test-dpplugin || true - cd awesome-widgets/build && xvfb-run ./test/awesomewidgets-test-dpplugin || true
- sleep 3
script: script:
- "curl -s https://raw.githubusercontent.com/mikkeloscar/arch-travis/master/arch-travis.sh | bash" - "curl -s https://raw.githubusercontent.com/mikkeloscar/arch-travis/master/arch-travis.sh | bash"

View File

@ -91,6 +91,12 @@ AWKeys::~AWKeys()
} }
bool AWKeys::isDBusActive() const
{
return m_dbusActive;
}
void AWKeys::initDataAggregator(const QVariantMap tooltipParams) void AWKeys::initDataAggregator(const QVariantMap tooltipParams)
{ {
qCDebug(LOG_AW) << "Tooltip parameters" << tooltipParams; qCDebug(LOG_AW) << "Tooltip parameters" << tooltipParams;
@ -338,9 +344,13 @@ void AWKeys::createDBusInterface()
qCWarning(LOG_AW) << "Could not register DBus service, last error" qCWarning(LOG_AW) << "Could not register DBus service, last error"
<< bus.lastError().message(); << bus.lastError().message();
if (!bus.registerObject(QString("/%1").arg(id), new AWDBusAdaptor(this), if (!bus.registerObject(QString("/%1").arg(id), new AWDBusAdaptor(this),
QDBusConnection::ExportAllContents)) QDBusConnection::ExportAllContents)) {
qCWarning(LOG_AW) << "Could not register DBus object, last error" qCWarning(LOG_AW) << "Could not register DBus object, last error"
<< bus.lastError().message(); << bus.lastError().message();
m_dbusActive = false;
} else {
m_dbusActive = true;
}
} }

View File

@ -39,6 +39,7 @@ class AWKeys : public QObject
public: public:
explicit AWKeys(QObject *parent = nullptr); explicit AWKeys(QObject *parent = nullptr);
virtual ~AWKeys(); virtual ~AWKeys();
bool isDBusActive() const;
Q_INVOKABLE void initDataAggregator(const QVariantMap tooltipParams); Q_INVOKABLE void initDataAggregator(const QVariantMap tooltipParams);
Q_INVOKABLE void initKeys(const QString currentPattern, const int interval, Q_INVOKABLE void initKeys(const QString currentPattern, const int interval,
const int limit, const bool optimize); const int limit, const bool optimize);
@ -86,6 +87,7 @@ private:
AWKeyOperations *m_keyOperator = nullptr; AWKeyOperations *m_keyOperator = nullptr;
QTimer *m_timer = nullptr; QTimer *m_timer = nullptr;
// variables // variables
bool m_dbusActive = false;
QVariantMap m_tooltipParams; QVariantMap m_tooltipParams;
QStringList m_foundBars, m_foundKeys, m_foundLambdas, m_requiredKeys; QStringList m_foundBars, m_foundKeys, m_foundLambdas, m_requiredKeys;
QVariantHash m_values; QVariantHash m_values;

View File

@ -83,6 +83,18 @@ ExtScript *ExtScript::copy(const QString _fileName, const int _number)
} }
QString ExtScript::jsonFiltersFile() const
{
QString fileName = QStandardPaths::locate(
QStandardPaths::GenericDataLocation,
QString(
"awesomewidgets/scripts/awesomewidgets-extscripts-filters.json"));
qCInfo(LOG_LIB) << "Filters file" << fileName;
return filename;
}
QString ExtScript::executable() const QString ExtScript::executable() const
{ {
return m_executable; return m_executable;
@ -240,11 +252,7 @@ void ExtScript::readConfiguration()
void ExtScript::readJsonFilters() void ExtScript::readJsonFilters()
{ {
QString fileName = QStandardPaths::locate( QString fileName = jsonFiltersFile();
QStandardPaths::GenericDataLocation,
QString(
"awesomewidgets/scripts/awesomewidgets-extscripts-filters.json"));
qCInfo(LOG_LIB) << "Filters file" << fileName;
QFile jsonFile(fileName); QFile jsonFile(fileName);
if (!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
qCWarning(LOG_LIB) << "Could not open" << fileName; qCWarning(LOG_LIB) << "Could not open" << fileName;

View File

@ -47,6 +47,7 @@ public:
explicit ExtScript(QWidget *parent, const QString filePath = QString()); explicit ExtScript(QWidget *parent, const QString filePath = QString());
virtual ~ExtScript(); virtual ~ExtScript();
ExtScript *copy(const QString _fileName, const int _number); ExtScript *copy(const QString _fileName, const int _number);
QString jsonFiltersFile() const;
// get methods // get methods
QString executable() const; QString executable() const;
QStringList filters() const; QStringList filters() const;

View File

@ -95,6 +95,17 @@ ExtWeather *ExtWeather::copy(const QString _fileName, const int _number)
} }
QString ExtWeather::jsonMapFile() const
{
QString fileName = QStandardPaths::locate(
QStandardPaths::GenericDataLocation,
QString("awesomewidgets/weather/awesomewidgets-extweather-ids.json"))
qCInfo(LOG_LIB) << "Map file" << fileName;
return fileName
}
QString ExtWeather::weatherFromInt(const int _id) const QString ExtWeather::weatherFromInt(const int _id) const
{ {
qCDebug(LOG_LIB) << "Weather ID" << _id; qCDebug(LOG_LIB) << "Weather ID" << _id;
@ -236,10 +247,7 @@ void ExtWeather::readConfiguration()
void ExtWeather::readJsonMap() void ExtWeather::readJsonMap()
{ {
QString fileName = QStandardPaths::locate( QString fileName = jsonMapFile();
QStandardPaths::GenericDataLocation,
QString("awesomewidgets/weather/awesomewidgets-extweather-ids.json"));
qCInfo(LOG_LIB) << "Map file" << fileName;
QFile jsonFile(fileName); QFile jsonFile(fileName);
if (!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
qCWarning(LOG_LIB) << "Could not open" << fileName; qCWarning(LOG_LIB) << "Could not open" << fileName;

View File

@ -45,6 +45,7 @@ public:
explicit ExtWeather(QWidget *parent, const QString filePath = QString()); explicit ExtWeather(QWidget *parent, const QString filePath = QString());
virtual ~ExtWeather(); virtual ~ExtWeather();
ExtWeather *copy(const QString _fileName, const int _number); ExtWeather *copy(const QString _fileName, const int _number);
QString jsonMapFile() const;
QString weatherFromInt(const int _id) const; QString weatherFromInt(const int _id) const;
// get methods // get methods
QString city() const; QString city() const;

View File

@ -18,6 +18,7 @@
#include "testawkeys.h" #include "testawkeys.h"
#include <KWindowSystem>
#include <QDBusConnection> #include <QDBusConnection>
#include <QDBusMessage> #include <QDBusMessage>
#include <QtTest> #include <QtTest>
@ -112,6 +113,9 @@ void TestAWKeys::test_pattern()
void TestAWKeys::test_tooltip() void TestAWKeys::test_tooltip()
{ {
if (!KWindowSystem::workArea().isValid())
QSKIP("KWin inactive, skip tooltip test");
QSignalSpy spy(plugin, SIGNAL(needToolTipToBeUpdated(const QString))); QSignalSpy spy(plugin, SIGNAL(needToolTipToBeUpdated(const QString)));
QVERIFY(spy.wait(5 * interval)); QVERIFY(spy.wait(5 * interval));
@ -164,6 +168,9 @@ void TestAWKeys::test_valueByKey()
void TestAWKeys::test_dbus() void TestAWKeys::test_dbus()
{ {
if (!plugin->isDBusActive())
QSKIP("No DBus session created, skip DBus test");
// get id // get id
qlonglong id = reinterpret_cast<qlonglong>(plugin); qlonglong id = reinterpret_cast<qlonglong>(plugin);

View File

@ -41,7 +41,7 @@ void TestDPPlugin::cleanupTestCase()
void TestDPPlugin::test_desktops() void TestDPPlugin::test_desktops()
{ {
if (!m_isKwinActive) if (!m_isKwinActive)
QSKIP("KWin inactive, skip tests"); QSKIP("KWin inactive, skip Destkop panel tests");
int current = plugin->currentDesktop(); int current = plugin->currentDesktop();
int total = plugin->numberOfDesktops(); int total = plugin->numberOfDesktops();
@ -67,7 +67,7 @@ void TestDPPlugin::test_desktops()
void TestDPPlugin::test_dictKeys() void TestDPPlugin::test_dictKeys()
{ {
if (!m_isKwinActive) if (!m_isKwinActive)
QSKIP("KWin inactive, skip tests"); QSKIP("KWin inactive, skip Destkop panel tests");
QCOMPARE(plugin->dictKeys().count(), 4); QCOMPARE(plugin->dictKeys().count(), 4);
pattern += plugin->dictKeys().join(QString(" $")); pattern += plugin->dictKeys().join(QString(" $"));
@ -77,7 +77,7 @@ void TestDPPlugin::test_dictKeys()
void TestDPPlugin::test_infoByKey() void TestDPPlugin::test_infoByKey()
{ {
if (!m_isKwinActive) if (!m_isKwinActive)
QSKIP("KWin inactive, skip tests"); QSKIP("KWin inactive, skip Destkop panel tests");
// nothing to test here yet // nothing to test here yet
QVERIFY(true); QVERIFY(true);
@ -87,7 +87,7 @@ void TestDPPlugin::test_infoByKey()
void TestDPPlugin::test_parsePattern() void TestDPPlugin::test_parsePattern()
{ {
if (!m_isKwinActive) if (!m_isKwinActive)
QSKIP("KWin inactive, skip tests"); QSKIP("KWin inactive, skip Destkop panel tests");
QString result = plugin->parsePattern(pattern, plugin->currentDesktop()); QString result = plugin->parsePattern(pattern, plugin->currentDesktop());
QVERIFY(!result.isEmpty()); QVERIFY(!result.isEmpty());
@ -100,7 +100,7 @@ void TestDPPlugin::test_parsePattern()
void TestDPPlugin::test_tooltipImage() void TestDPPlugin::test_tooltipImage()
{ {
if (!m_isKwinActive) if (!m_isKwinActive)
QSKIP("KWin inactive, skip tests"); QSKIP("KWin inactive, skip Destkop panel tests");
QVariantMap data; QVariantMap data;
data[QString("tooltipColor")] = QString("#000000"); data[QString("tooltipColor")] = QString("#000000");

View File

@ -75,6 +75,9 @@ void TestExtScript::test_run()
void TestExtScript::test_filters() void TestExtScript::test_filters()
{ {
if (extScript->jsonFiltersFile().isEmpty())
QSKIP("No json filters found for scripts, skip fitlers test");
extScript->setFilters(QStringList() << QString("newline")); extScript->setFilters(QStringList() << QString("newline"));
// init spy // init spy
QSignalSpy spy(extScript, SIGNAL(dataReceived(const QVariantHash &))); QSignalSpy spy(extScript, SIGNAL(dataReceived(const QVariantHash &)));

View File

@ -75,6 +75,9 @@ void TestExtWeather::test_ts()
void TestExtWeather::test_image() void TestExtWeather::test_image()
{ {
if (extWeather->jsonMapFile().isEmpty())
QSKIP("No json map found for weather, skip image test");
extWeather->setImage(true); extWeather->setImage(true);
// init spy // init spy
QSignalSpy spy(extWeather, SIGNAL(dataReceived(const QVariantHash &))); QSignalSpy spy(extWeather, SIGNAL(dataReceived(const QVariantHash &)));
@ -129,6 +132,8 @@ void TestExtWeather::run()
&& (arguments[extWeather->tag(QString("temperature"))].toFloat() && (arguments[extWeather->tag(QString("temperature"))].toFloat()
< temp.second)); < temp.second));
// image should be only one symbol here // image should be only one symbol here
if (extWeather->jsonMapFile().isEmpty())
QSKIP("No json map found for weather, skip image test");
QCOMPARE(arguments[extWeather->tag(QString("weather"))].toString().count(), QCOMPARE(arguments[extWeather->tag(QString("weather"))].toString().count(),
1); 1);
} }