another iteration with fix travis tests

This commit is contained in:
Evgenii Alekseev 2017-02-14 04:26:59 +03:00
parent a30e6ba21b
commit b818586a23
6 changed files with 17 additions and 20 deletions

View File

@ -18,12 +18,6 @@ arch:
- cd awesome-widgets/build && make
- cd awesome-widgets/build && xvfb-run make test || true
- sleep 3
- cd awesome-widgets/build && xvfb-run ./test/awesomewidgets-test-extscript || true
- sleep 3
- cd awesome-widgets/build && xvfb-run ./test/awesomewidgets-test-extweather || true
- sleep 3
- cd awesome-widgets/build && xvfb-run ./test/awesomewidgets-test-playersource || true
- sleep 3
- cd awesome-widgets/build && xvfb-run ./test/awesomewidgets-test-awkeys || true
- sleep 3
- cd awesome-widgets/build && xvfb-run ./test/awesomewidgets-test-dpplugin || true

View File

@ -18,19 +18,30 @@
#include "awtestlibrary.h"
#include <KWindowSystem>
#include <QSet>
#include <QStandardPaths>
bool AWTestLibrary::isKWinActive()
{
KWindowSystem::setShowingDesktop(true);
bool state = KWindowSystem::showingDesktop();
KWindowSystem::setShowingDesktop(false);
return state;
}
char AWTestLibrary::randomChar()
{
return 'A' + (rand() % static_cast<int>('Z' - 'A'));
return 'A' + (qrand() % static_cast<int>('Z' - 'A'));
}
double AWTestLibrary::randomDouble()
{
return static_cast<double>(rand()) / static_cast<double>(RAND_MAX);
return static_cast<double>(qrand()) / static_cast<double>(RAND_MAX);
}
@ -52,7 +63,7 @@ QPair<QString, QString> AWTestLibrary::randomFilenames()
int AWTestLibrary::randomInt(const int max)
{
return rand() % max;
return qrand() % max;
}

View File

@ -25,6 +25,7 @@
namespace AWTestLibrary
{
bool isKWinActive();
char randomChar();
double randomDouble();
QPair<QString, QString> randomFilenames();

View File

@ -18,7 +18,6 @@
#include "testawkeys.h"
#include <KWindowSystem>
#include <QDBusConnection>
#include <QDBusMessage>
#include <QtTest>
@ -113,7 +112,7 @@ void TestAWKeys::test_pattern()
void TestAWKeys::test_tooltip()
{
if (!KWindowSystem::workArea().isValid())
if (!AWTestLibrary::isKWinActive())
QSKIP("KWin inactive, skip tooltip test");
QSignalSpy spy(plugin, SIGNAL(needToolTipToBeUpdated(const QString)));

View File

@ -18,7 +18,6 @@
#include "testdpplugin.h"
#include <KWindowSystem>
#include <QtTest>
#include "awtestlibrary.h"
@ -28,7 +27,7 @@
void TestDPPlugin::initTestCase()
{
plugin = new DPAdds(this);
m_isKwinActive = checkKwinStatus();
m_isKwinActive = AWTestLibrary::isKWinActive();
}
@ -114,10 +113,4 @@ void TestDPPlugin::test_tooltipImage()
}
bool TestDPPlugin::checkKwinStatus() const
{
return KWindowSystem::workArea().isValid();
}
QTEST_MAIN(TestDPPlugin);

View File

@ -40,7 +40,6 @@ private slots:
void test_parsePattern();
private:
bool checkKwinStatus() const;
DPAdds *plugin = nullptr;
bool m_isKwinActive = false;
QString pattern = QString("$");