-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathqtconceptmapcommandsetmode_test.cpp
55 lines (50 loc) · 1.52 KB
/
qtconceptmapcommandsetmode_test.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
#include "qtconceptmapcommandsetmode_test.h"
#include "qtconceptmapcommandsetmode.h"
#include "qtconceptmapcommandcreatenewnode.h"
#include "qtconceptmap.h"
#include <QDebug>
void ribi::cmap::QtCommandSetModeTest::Parse() const noexcept
{
QtConceptMap q;
QVERIFY(ParseCommandSetMode(q, "nonsense") == nullptr);
QVERIFY(ParseCommandSetMode(q, "set_mode(nonsense)") == nullptr);
//Set edit mode
{
assert(q.GetMode() != Mode::edit);
const auto cmd = ParseCommandSetMode(q, "set_mode(edit)");
q.DoCommand(cmd);
QVERIFY(q.GetMode() == Mode::edit);
}
//Set rate mode
{
assert(q.GetMode() != Mode::rate);
const auto cmd = ParseCommandSetMode(q, "set_mode(rate)");
q.DoCommand(cmd);
QVERIFY(q.GetMode() == Mode::rate);
}
//Set rate mode
{
assert(q.GetMode() != Mode::uninitialized);
const auto cmd = ParseCommandSetMode(q, "set_mode(uninitialized)");
q.DoCommand(cmd);
QVERIFY(q.GetMode() == Mode::uninitialized);
}
}
void ribi::cmap::QtCommandSetModeTest::SetToEditMode() const noexcept
{
QtConceptMap q;
q.showFullScreen();
assert(q.GetMode() == Mode::uninitialized);
q.DoCommand(new CommandSetMode(q, Mode::edit));
QVERIFY(q.GetMode() == Mode::edit);
}
void ribi::cmap::QtCommandSetModeTest::SetToEditModeAndUndo() const noexcept
{
QtConceptMap q;
q.showFullScreen();
assert(q.GetMode() == Mode::uninitialized);
q.DoCommand(new CommandSetMode(q, Mode::edit));
assert(q.GetMode() != Mode::uninitialized);
q.Undo();
QVERIFY(q.GetMode() == Mode::uninitialized);
}