f0971fb8dd899c4b23d53e0af498bfbf81fdb8f9
[emufront] / testing / EmuFrontTesting / platformtest.cpp
1 #include "platformtest.h"
2 #include "../../src/dataobjects/platform.h"
3 #include "../../src/dataobjects/emufrontfile.h"
4
5 Q_DECLARE_METATYPE(EmuFrontFile)
6 Q_DECLARE_METATYPE(Platform)
7
8 void PlatformTest::initTestCase()
9 {
10     qDebug() << "Initializing PlatformTest.";
11     EmuFrontFile *efile = new EmuFrontFile(1, "zzz.png", "2hxxxx", 2, 1);
12 }
13
14 void PlatformTest::cleanupTestCase()
15 {
16     qDebug() << "Cleaning up PlatformTest.";
17     delete efile;
18 }
19
20 void PlatformTest::equals_data()
21 {
22     QTest::addColumn<Platform>("platform1");
23     QTest::addColumn<Platform>("platform2");
24     QTest::newRow("id and name")
25         << Platform(1, "test", efile)
26         << Platform(1, "test", efile);
27     QTest::newRow("id, name and filename")
28         << Platform(2, "test", efile)
29         << Platform(2, "test", efile);
30 }
31
32 void PlatformTest::equals()
33 {
34     QFETCH(Platform, platform1);
35     QFETCH(Platform, platform2);
36     QVERIFY(platform1 == platform2);
37 }
38
39 /* Platforms are equal if the following fields match:
40     - id (int)
41     - name (QString)
42 */
43 void PlatformTest::notEquals()
44 {
45     Platform p1(1, "testa", efile);
46     Platform p2(1, "test", efile);
47     // This should return true
48     QVERIFY(p1 != p2);
49 }