~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to libs/ksysguard/tests/signalplotterbenchmark.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "signalplotterbenchmark.h"
 
2
#include "../../../libs/ksysguard/signalplotter/ksignalplotter.h"
 
3
 
 
4
#include <qtest_kde.h>
 
5
#include <QtTest>
 
6
#include <QtGui>
 
7
#include <limits>
 
8
 
 
9
void BenchmarkSignalPlotter::init()
 
10
{
 
11
    s = new KSignalPlotter;
 
12
}
 
13
void BenchmarkSignalPlotter::cleanup()
 
14
{
 
15
    delete s;
 
16
}
 
17
 
 
18
void BenchmarkSignalPlotter::addData()
 
19
{
 
20
    s->addBeam(Qt::blue);
 
21
    s->addBeam(Qt::green);
 
22
    s->addBeam(Qt::red);
 
23
    s->addBeam(Qt::yellow);
 
24
    s->show();
 
25
    s->setMaxAxisTextWidth(5);
 
26
    s->resize(1000,500);
 
27
    QTest::qWaitForWindowShown(s);
 
28
 
 
29
    QBENCHMARK {
 
30
        s->addSample(QList<qreal>() << qrand()%10 << qrand()%10 << qrand()%10 << qrand()%10);
 
31
        qApp->processEvents();
 
32
    }
 
33
 
 
34
}
 
35
void BenchmarkSignalPlotter::stackedData()
 
36
{
 
37
    s->addBeam(Qt::blue);
 
38
    s->addBeam(Qt::green);
 
39
    s->addBeam(Qt::red);
 
40
    s->addBeam(Qt::yellow);
 
41
    s->setStackGraph(true);
 
42
    s->show();
 
43
    s->setMaxAxisTextWidth(5);
 
44
    s->resize(1000,500);
 
45
    QTest::qWaitForWindowShown(s);
 
46
 
 
47
    QBENCHMARK {
 
48
        s->addSample(QList<qreal>() << qrand()%10 << qrand()%10 << qrand()%10 << qrand()%10);
 
49
        qApp->processEvents();
 
50
    }
 
51
 
 
52
}
 
53
void BenchmarkSignalPlotter::addDataWhenHidden()
 
54
{
 
55
    s->addBeam(Qt::blue);
 
56
    s->addBeam(Qt::green);
 
57
    s->addBeam(Qt::red);
 
58
    s->addBeam(Qt::yellow);
 
59
 
 
60
    QBENCHMARK {
 
61
        s->addSample(QList<qreal>() << qrand()%10 << qrand()%10 << qrand()%10 << qrand()%10);
 
62
        qApp->processEvents();
 
63
    }
 
64
 
 
65
}
 
66
 
 
67
QTEST_KDEMAIN(BenchmarkSignalPlotter, GUI)
 
68