From 26504480b23b4ea0a2c5e2a01519b47c9340315b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 30 Jul 2013 23:19:10 +0200 Subject: [PATCH] Test whole AbstractResourceLoader API. --- src/Test/ResourceManagerTest.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Test/ResourceManagerTest.cpp b/src/Test/ResourceManagerTest.cpp index 8235d2328..11e9c8f8c 100644 --- a/src/Test/ResourceManagerTest.cpp +++ b/src/Test/ResourceManagerTest.cpp @@ -237,6 +237,11 @@ void ResourceManagerTest::loader() { private: void doLoad(ResourceKey) override {} + + std::string doName(ResourceKey key) const override { + if(key == ResourceKey("hello")) return "hello"; + return ""; + } }; auto rm = new ResourceManager; @@ -250,10 +255,19 @@ void ResourceManagerTest::loader() { CORRADE_COMPARE(hello.state(), ResourceState::Loading); CORRADE_COMPARE(world.state(), ResourceState::Loading); + CORRADE_COMPARE(loader->requestedCount(), 2); + CORRADE_COMPARE(loader->loadedCount(), 0); + CORRADE_COMPARE(loader->notFoundCount(), 0); + CORRADE_COMPARE(loader->name(ResourceKey("hello")), "hello"); + loader->load(); CORRADE_COMPARE(hello.state(), ResourceState::Final); CORRADE_COMPARE(*hello, 773); CORRADE_COMPARE(world.state(), ResourceState::NotFound); + + CORRADE_COMPARE(loader->requestedCount(), 2); + CORRADE_COMPARE(loader->loadedCount(), 1); + CORRADE_COMPARE(loader->notFoundCount(), 1); } }}