summaryrefslogtreecommitdiffstats
path: root/sigmod/test/TestItem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sigmod/test/TestItem.cpp')
-rw-r--r--sigmod/test/TestItem.cpp45
1 files changed, 23 insertions, 22 deletions
diff --git a/sigmod/test/TestItem.cpp b/sigmod/test/TestItem.cpp
index c2f4a639..f5cf12b3 100644
--- a/sigmod/test/TestItem.cpp
+++ b/sigmod/test/TestItem.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Ben Boeckel <MathStuf@gmail.com>
+ * Copyright 2008-2009 Ben Boeckel <MathStuf@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,24 +19,25 @@
#include "TestItem.h"
// Sigmod includes
+#include "../Game.h"
#include "../Item.h"
#include "../ItemType.h"
#include "../Rules.h"
-#include "../Sigmod.h"
// Qt includes
#include <QtCore/QFile>
#include <QtTest/QTest>
-#include <QtCore/QtDebug>
+using namespace Sigcore;
+using namespace Sigmod;
void TestItem::initTestCase()
{
TestSigmodObject::initTestCase();
- m_item1 = m_sigmod->newItem();
- m_item2 = m_sigmod->newItem();
- m_item3 = m_sigmod->newItem();
+ m_item1 = m_game->newItem();
+ m_item2 = m_game->newItem();
+ m_item3 = m_game->newItem();
}
void TestItem::cleanupTestCase()
@@ -75,7 +76,7 @@ void TestItem::validation()
QCOMPARE(m_warnings.size(), 0);
QCOMPARE(m_errors.size(), 5);
- m_sigmod->newItemType();
+ m_game->newItemType();
m_item1->setType(0);
m_item1->validate();
@@ -83,7 +84,7 @@ void TestItem::validation()
QCOMPARE(m_warnings.size(), 0);
QCOMPARE(m_errors.size(), 6);
- m_sigmod->rules()->setMaxMoney(1000);
+ m_game->rules()->setMaxMoney(1000);
m_item1->setPrice(500);
m_item1->validate();
@@ -113,8 +114,8 @@ void TestItem::validation()
QCOMPARE(m_warnings.size(), 0);
QCOMPARE(m_errors.size(), 7);
- m_sigmod->rules()->setMaxTotalWeight(100);
- m_sigmod->itemType(0)->setMaxWeight(50);
+ m_game->rules()->setMaxTotalWeight(100);
+ m_game->itemType(0)->setMaxWeight(50);
m_item1->setWeight(20);
m_item1->validate();
@@ -122,14 +123,14 @@ void TestItem::validation()
QCOMPARE(m_warnings.size(), 0);
QCOMPARE(m_errors.size(), 7);
- m_sigmod->itemType(0)->setMaxWeight(10);
+ m_game->itemType(0)->setMaxWeight(10);
m_item1->validate();
QCOMPARE(m_warnings.size(), 0);
QCOMPARE(m_errors.size(), 8);
- m_sigmod->itemType(0)->setMaxWeight(50);
+ m_game->itemType(0)->setMaxWeight(50);
m_item1->validate();
@@ -139,7 +140,7 @@ void TestItem::validation()
void TestItem::saving()
{
- QDomDocument xml = Sigmod::Object::xml(m_item1);
+ QDomDocument xml = Object::xml(m_item1);
QFile file("item.xml");
QVERIFY(file.open(QIODevice::WriteOnly));
@@ -152,7 +153,7 @@ void TestItem::loading()
QDomDocument xml;
QFile file("item.xml");
- m_sigmod->newItemType();
+ m_game->newItemType();
m_item1->setName("Bar");
m_item1->setSellable(false);
@@ -161,7 +162,7 @@ void TestItem::loading()
m_item1->setSellPrice(10);
m_item1->setWeight(10);
m_item1->setDescription("An item.");
- m_item1->setScript(Sigcore::Script("python", "import os"));
+ m_item1->setScript(Script("python", "import os"));
QVERIFY(file.open(QIODevice::ReadOnly));
QVERIFY(xml.setContent(&file));
@@ -174,7 +175,7 @@ void TestItem::loading()
QCOMPARE(m_item1->sellPrice(), 250);
QCOMPARE(m_item1->weight(), 20);
QCOMPARE(m_item1->description(), QString(""));
- QCOMPARE(m_item1->script(), Sigcore::Script());
+ QCOMPARE(m_item1->script(), Script());
}
void TestItem::setName()
@@ -210,7 +211,7 @@ void TestItem::setType()
QCOMPARE(m_warnings.size(), 0);
QCOMPARE(m_errors.size(), 1);
- m_sigmod->newItemType();
+ m_game->newItemType();
m_item2->setType(2);
m_item2->setType(2);
@@ -281,7 +282,7 @@ void TestItem::setWeight()
QCOMPARE(m_warnings.size(), 0);
QCOMPARE(m_errors.size(), 2);
- m_sigmod->itemType(2)->setMaxWeight(50);
+ m_game->itemType(2)->setMaxWeight(50);
m_item2->setWeight(20);
m_item2->setWeight(20);
@@ -309,10 +310,10 @@ void TestItem::setDescription()
void TestItem::setScript()
{
- m_item2->setScript(Sigcore::Script("python", "import os"));
- m_item2->setScript(Sigcore::Script("python", "import os"));
+ m_item2->setScript(Script("python", "import os"));
+ m_item2->setScript(Script("python", "import os"));
- QCOMPARE(m_item2->script(), Sigcore::Script("python", "import os"));
+ QCOMPARE(m_item2->script(), Script("python", "import os"));
QCOMPARE(m_changedCount, 1);
@@ -331,7 +332,7 @@ void TestItem::assignment()
QCOMPARE(m_item3->sellPrice(), 50);
QCOMPARE(m_item3->weight(), 20);
QCOMPARE(m_item3->description(), QString("An item."));
- QCOMPARE(m_item3->script(), Sigcore::Script("python", "import os"));
+ QCOMPARE(m_item3->script(), Script("python", "import os"));
}
QTEST_APPLESS_MAIN(TestItem)