Skip to content
Open
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
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: '00 01 */4 * *'

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Install Qt
uses: jurplel/install-qt-action@v2
- name: Check infrastructure
run: |
qmake --version
nproc --all
echo "Done"
shell: bash
- name: Build and test (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
set -e
sudo apt-get install xvfb
cd $GITHUB_WORKSPACE
cd tests/testableunittests/
qmake
make -j `nproc --all`
xvfb-run --auto-servernum ./testableunittests
cd ../../tests/testablecmdtests
qmake
make -j `nproc --all`
./run-tests.sh
shell: bash
8 changes: 4 additions & 4 deletions automator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <QEventLoop>
#include <QTimer>
#include <QQuickItem>
#include <QTime>
#include <QElapsedTimer>
#include <QTest>
#include <QSignalSpy>
#include "automator.h"
Expand Down Expand Up @@ -151,7 +151,7 @@ QObjectList Automator::findObjects(QString objectName)

bool Automator::waitExists(QString objectName, int timeout)
{
QTime time;
QElapsedTimer time;
time.start();

while (true) {
Expand All @@ -174,7 +174,7 @@ bool Automator::waitExists(QString objectName, int timeout)
bool Automator::waitUntil(QObject *object, QString property, QVariant value, int timeout)
{
QVariant objectValue = object->property(property.toLocal8Bit().constData());
QTime time;
QElapsedTimer time;
time.start();

while (objectValue != value) {
Expand Down Expand Up @@ -213,7 +213,7 @@ bool Automator::waitUntilSignal(QObject *object, const char *signal, int timeout

bool Automator::waitUntil(QString objectName, QString property, QVariant value, int timeout)
{
QTime time;
QElapsedTimer time;
time.start();

QObject* object = findObject(objectName);
Expand Down
4 changes: 2 additions & 2 deletions automator.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <QPointer>
#include <QQuickItem>
#include <QPointF>
#include <QTime>
#include <QElapsedTimer>

/// Automator provides an interface to manipulate UI object loaded by QQmlApplicationEngine

Expand Down Expand Up @@ -51,7 +51,7 @@ class Automator : public QObject

template <typename Functor>
bool waitUntil(Functor functor, int timeout = -1) {
QTime time;
QElapsedTimer time;
time.start();

while (!functor()) {
Expand Down
2 changes: 1 addition & 1 deletion tests/testablecmdtests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ OUTPUT="default"
fi

echo "testable $ARG"
./testablecmdtests $ARG | grep Totals > $OUTPUT.out 2>&1
xvfb-run --auto-servernum ./testablecmdtests $ARG | grep Totals | sed 's/, [[:digit:]]\+ms//g' > $OUTPUT.out 2>&1
diff -uN $SRCDIR/$OUTPUT.expected $OUTPUT.out
}

Expand Down
3 changes: 2 additions & 1 deletion tests/testableunittests/testableunittests.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <QtCore>
#include <QTest>
#include <QQmlApplicationEngine>
#include <QElapsedTimer>
#include <Automator>
#include <TestRunner>
#include "testableunittests.h"
Expand Down Expand Up @@ -61,7 +62,7 @@ void TestableUnitTests::automatorObtainSingletonObject()
void TestableUnitTests::automatorWaitUntilSignal()
{
QTimer * timer = new QTimer(this);
QTime time;
QElapsedTimer time;
time.start();

timer->setInterval(500);
Expand Down