Implemented unit tests for:
[yamf.git] / tests / command / editnodesitem / test_editnodesitem.cpp
blob6fad46f949c8e5bcd4c6b973a341b594b6f0d47e
2 #include <QtTest/QtTest>
4 #include <QFile>
5 #include <QDebug>
7 #include <model/command/editnodesitem.h>
8 #include <model/scene.h>
9 #include <model/layer.h>
10 #include <model/frame.h>
11 #include <model/object.h>
12 #include <common/inthash.h>
14 #include <QGraphicsPathItem>
15 #include <QGraphicsRectItem>
18 class TestEditNodesItem: public QObject
20 Q_OBJECT
21 private slots:
22 void initTestCase();
23 void cleanupTestCase();
24 void execute();
25 void unexecute();
27 private:
28 YAMF::Command::EditNodesItem *cmd;
29 QPainterPath newPath;
30 QPainterPath oldPath;
31 QGraphicsPathItem* item;
34 void TestEditNodesItem::initTestCase()
36 QFont font;
37 oldPath.addText(QPoint(0,0),font, QString("old path"));
38 newPath.addText(QPoint(0,0),font, QString("new path"));
39 item = new QGraphicsPathItem(oldPath);
40 cmd = new YAMF::Command::EditNodesItem(item, newPath);
43 void TestEditNodesItem::cleanupTestCase()
45 delete item;
46 delete cmd;
49 void TestEditNodesItem::execute()
51 cmd->redo();
52 QCOMPARE(item->path(), newPath);
55 void TestEditNodesItem::unexecute()
57 cmd->undo();
58 QCOMPARE(item->path(), oldPath);
62 QTEST_MAIN(TestEditNodesItem)
63 #include "test_editnodesitem.moc"