aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/x11vkbtest/testbase.cpp
blob: ef555aae9d1c713558e5d8be43bbc239d40a32e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (C) 2019 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include <QTextStream>
#include "testbase.h"

namespace {
const qint32 KMs_In_Sec = 1000;
}

TestBase::TestBase(QObject *parent, QString testName, quint32 numberOfTests, qint64 x11vkbProcId):
    QObject(parent),
    m_x11vkbProcId(x11vkbProcId),
    m_testTimer(QElapsedTimer()),
    m_timeElapsed(0),
    m_testName(testName),
    m_numberOfTests(numberOfTests),
    m_testResult(QString()),
    m_passed(false)

{}

QString TestBase::reportResult()
{
    return m_testResult;
}

void TestBase::setProcID(const qint64 procID)
{
    m_x11vkbProcId = procID;
}

QString TestBase::testName() const
{
    return m_testName;
}

void TestBase::setTestName()
{
    m_testName = m_testName.arg(m_numberOfTests);
}
void TestBase::printResult(QTextStream &stream) const
{
    stream << m_testResult;
}

bool TestBase::passed() const
{
    return m_passed;
}

qint64 TestBase::timeElapsed() const
{
    return m_timeElapsed/KMs_In_Sec;
}

bool TestBase::shiftIsDown = false;

void TestBase::setTestRepeats(const quint32 repeats)
{
    if (m_numberOfTests == 0) {
        m_numberOfTests = repeats;
    }
}