aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmlprofiler/tests/qmlprofilertraceview_test.cpp
blob: a8787b940790a24dda08833ead9d04d6b6180ccf (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
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#include "qmlprofilertraceview_test.h"
#include <QtTest>

namespace QmlProfiler {
namespace Internal {

QmlProfilerTraceViewTest::QmlProfilerTraceViewTest(QObject *parent) :
    QObject(parent), traceView(nullptr, nullptr, &modelManager)
{
}

void QmlProfilerTraceViewTest::testStateChanges()
{
    // Standard acquire-process-clear work flow
    modelManager.initialize();
    QVERIFY(traceView.isSuspended());
    modelManager.finalize();
    QVERIFY(!traceView.isSuspended());
    modelManager.clearAll();
    QVERIFY(!traceView.isSuspended());

    // Restrict to range
    modelManager.initialize();
    QVERIFY(traceView.isSuspended());
    modelManager.finalize();
    QVERIFY(!traceView.isSuspended());
    modelManager.restrictToRange(10, 14);
    QVERIFY(!traceView.isSuspended());
    modelManager.restrictToRange(-1, -1);
    QVERIFY(!traceView.isSuspended());
    modelManager.clearAll();
    QVERIFY(!traceView.isSuspended());

    // Abort Acquiring
    modelManager.initialize();
    QVERIFY(traceView.isSuspended());
    modelManager.clearAll();
    QVERIFY(!traceView.isSuspended());
}

} // namespace Internal
} // namespace QmlProfiler