forked from jurplel/qView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtst_actionmanagertests.cpp
56 lines (42 loc) · 1.43 KB
/
tst_actionmanagertests.cpp
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
#include <QtTest>
#include "qvapplication.h"
class ActionManagerTests : public QObject
{
Q_OBJECT
public:
ActionManagerTests();
~ActionManagerTests();
private slots:
void testClonedActionsUntracked();
};
ActionManagerTests::ActionManagerTests()
{
}
ActionManagerTests::~ActionManagerTests()
{
}
void ActionManagerTests::testClonedActionsUntracked()
{
// Get initial counts of certain actions
int fullscreenCount = qvApp->getActionManager().getAllInstancesOfAction("fullscreen").length();
int openCount = qvApp->getActionManager().getAllInstancesOfAction("open").length();
qDebug() << fullscreenCount;
// Have window clone actions
MainWindow window;
window.show();
// Make sure they were cloned
QVERIFY(qvApp->getActionManager().getAllInstancesOfAction("fullscreen").length() != fullscreenCount);
QVERIFY(qvApp->getActionManager().getAllInstancesOfAction("open").length() != openCount);
// Untrack them
window.close();
// Make sure the count has not changed from the initial
QCOMPARE(qvApp->getActionManager().getAllInstancesOfAction("fullscreen").length(), fullscreenCount);
QCOMPARE(qvApp->getActionManager().getAllInstancesOfAction("open").length(), openCount);
}
int main(int argc, char *argv[])
{
QVApplication app(argc, argv);
ActionManagerTests actionManagerTests;
return QTest::qExec(&actionManagerTests, argc, argv);
}
#include "tst_actionmanagertests.moc"