summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJan Dalheimer <jan@dalheimer.de>2015-06-06 12:30:49 +0200
committerPetr Mrázek <peterix@gmail.com>2015-06-06 21:23:05 +0200
commit1e51b62c882b5fc1554efb46cb41c3d54157626c (patch)
tree08e81ac1382d8528584c9f237aaf8ff976e2af8a /tests
parent24db645167b42adba5d9c221215be83bef39e2a1 (diff)
downloadMultiMC-1e51b62c882b5fc1554efb46cb41c3d54157626c.tar
MultiMC-1e51b62c882b5fc1554efb46cb41c3d54157626c.tar.gz
MultiMC-1e51b62c882b5fc1554efb46cb41c3d54157626c.tar.lz
MultiMC-1e51b62c882b5fc1554efb46cb41c3d54157626c.tar.xz
MultiMC-1e51b62c882b5fc1554efb46cb41c3d54157626c.zip
NOISSUE Comment and bugfix the Resource system
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt1
-rw-r--r--tests/tst_Resource.cpp26
2 files changed, 22 insertions, 5 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 2cf9e7cb..6e66c834 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -29,6 +29,7 @@ add_unit_test(modutils tst_modutils.cpp)
add_unit_test(inifile tst_inifile.cpp)
add_unit_test(UpdateChecker tst_UpdateChecker.cpp)
add_unit_test(DownloadTask tst_DownloadTask.cpp)
+add_unit_test(Resource tst_Resource.cpp)
# Tests END #
diff --git a/tests/tst_Resource.cpp b/tests/tst_Resource.cpp
index ba6f0509..54d029d5 100644
--- a/tests/tst_Resource.cpp
+++ b/tests/tst_Resource.cpp
@@ -43,8 +43,8 @@ public:
class ResourceTest : public QObject
{
Q_OBJECT
-private
-slots:
+ private
+ slots:
void initTestCase()
{
Resource::registerHandler<DummyStringResourceHandler>("dummy");
@@ -75,10 +75,9 @@ slots:
void test_DontRequestPlaceholder()
{
- auto resource = Resource::create("dummy:asdf")
+ // since dummy:asdf immediently gives a value we should not get the placeholder
+ Resource::create("dummy:asdf", Resource::create("dummy:fdsa"))
->then([](const QString &key) { QCOMPARE(key, QStringLiteral("asdf")); });
- // the following call should not notify the observer. if it does the above QCOMPARE would fail.
- resource->placeholder(Resource::create("dummy:fdsa"));
}
void test_MergedResources()
@@ -94,6 +93,23 @@ slots:
QVERIFY(r2 != r3);
QVERIFY(r4 != r3);
}
+
+ void test_MergedResourceWithPlaceholder()
+ {
+ auto p1 = Resource::create("dummy:placeA");
+ auto p2 = Resource::create("dummy:placeB");
+
+ auto r1 = Resource::create("dummy:asdf");
+ auto r2 = Resource::create("dummy:asdf", p1);
+ auto r3 = Resource::create("dummy:asdf", p2);
+ auto r4 = Resource::create("dummy:asdf", p1);
+
+ QCOMPARE(r2, r4);
+ QVERIFY(r1 != r2);
+ QVERIFY(r1 != r3);
+ QVERIFY(r1 != r4);
+ QVERIFY(r2 != r3);
+ }
};
QTEST_GUILESS_MAIN(ResourceTest)