summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2019-03-06 17:28:57 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2019-03-06 17:28:57 +0100
commit5eb47bed81de1326843e1e3bad41addcfed08d4e (patch)
tree215bdc06a67ca880c1b286a098ba6f6e86b1b7a5 /test
parentf536d8479e37b1515ffb5737a9f276976bef3cf0 (diff)
Fix crash if opening Resource with a directory instead of a file.
Diffstat (limited to 'test')
-rw-r--r--test/resource_test.cc23
1 files changed, 20 insertions, 3 deletions
diff --git a/test/resource_test.cc b/test/resource_test.cc
index 2e88c45..28a244e 100644
--- a/test/resource_test.cc
+++ b/test/resource_test.cc
@@ -30,10 +30,12 @@
#include "drumkit_creator.h"
-class ResourceTester : public GUI::Resource {
+class ResourceTester
+ : public GUI::Resource
+{
public:
ResourceTester(const std::string& name)
- : Resource(name)
+ : GUI::Resource(name)
{}
bool probeIsInternal()
@@ -42,13 +44,15 @@ public:
}
};
-class ResourceTest : public DGUnit
+class ResourceTest
+ : public DGUnit
{
public:
ResourceTest()
{
DGUNIT_TEST(ResourceTest::externalReadTest);
DGUNIT_TEST(ResourceTest::internalReadTest);
+ DGUNIT_TEST(ResourceTest::failTest);
}
DrumkitCreator drumkit_creator;
@@ -70,6 +74,19 @@ public:
DGUNIT_ASSERT(rc.valid());
DGUNIT_ASSERT_EQUAL((size_t)1123, rc.size());
}
+
+ void failTest()
+ {
+ {
+ ResourceTester rc("/tmp/");
+ DGUNIT_ASSERT(!rc.valid());
+ }
+
+ {
+ ResourceTester rc("no_such_file");
+ DGUNIT_ASSERT(!rc.valid());
+ }
+ }
};
// Registers the fixture into the 'registry'