summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test-libplayback.cpp4
-rw-r--r--tests/test-libplayback.make8
-rw-r--r--tests/test-resource.cpp33
-rw-r--r--tests/test-resource.h3
4 files changed, 41 insertions, 7 deletions
diff --git a/tests/test-libplayback.cpp b/tests/test-libplayback.cpp
index 7cdb2bf..5607104 100644
--- a/tests/test-libplayback.cpp
+++ b/tests/test-libplayback.cpp
@@ -1,5 +1,7 @@
#include "test-libplayback.h"
+using namespace ResourceTypes;
+
TestLibplayback::TestLibplayback()
{
resourceFactory=NULL;
@@ -14,7 +16,7 @@ void TestLibplayback::initTestCase()
{
resourceFactory = new ResourceFactory(this);
QVERIFY(resourceFactory != NULL);
- Resource *resource = resourceFactory->createResource(MediaClass, RP_FLAGS_AUDIO|RP_FLAGS_VIDEO);
+ Resource *resource = resourceFactory->createResource(MediaClass, AudioResource|VideoResource);
QVERIFY(resource != NULL);
}
diff --git a/tests/test-libplayback.make b/tests/test-libplayback.make
index 3f0b861..8946476 100644
--- a/tests/test-libplayback.make
+++ b/tests/test-libplayback.make
@@ -1,6 +1,6 @@
#############################################################################
# Makefile for building: build/test-libplayback
-# Generated by qmake (2.01a) (Qt 4.6.0) on: Thu Dec 31 13:33:48 2009
+# Generated by qmake (2.01a) (Qt 4.6.0) on: Tue Jan 5 10:34:26 2010
# Project: test-libplayback.pro
# Template: app
# Command: /usr/bin/qmake -unix -o test-libplayback.make test-libplayback.pro
@@ -196,6 +196,8 @@ compiler_moc_header_clean:
-$(DEL_FILE) build/moc_test-libplayback.cpp build/moc_resource.cpp build/moc_resource-factory.cpp build/moc_libplayback-wrapper.cpp
build/moc_test-libplayback.cpp: ../include/resource-factory.h \
../include/resource-types.h \
+ ../include/resource.h \
+ ../src/resource-library.h \
test-libplayback.h
/usr/bin/moc $(DEFINES) $(INCPATH) test-libplayback.h -o build/moc_test-libplayback.cpp
@@ -247,7 +249,9 @@ compiler_clean: compiler_moc_header_clean
build/test-libplayback.o: test-libplayback.cpp test-libplayback.h \
../include/resource-factory.h \
- ../include/resource-types.h
+ ../include/resource-types.h \
+ ../include/resource.h \
+ ../src/resource-library.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o build/test-libplayback.o test-libplayback.cpp
build/libplayback-wrapper.o: ../src/libplayback-wrapper.cpp ../src/libplayback-wrapper.h \
diff --git a/tests/test-resource.cpp b/tests/test-resource.cpp
index eb2b59d..8f2e52e 100644
--- a/tests/test-resource.cpp
+++ b/tests/test-resource.cpp
@@ -1,4 +1,7 @@
#include "test-resource.h"
+
+using namespace ResourceTypes;
+
TestResource::TestResource()
{
}
@@ -9,12 +12,34 @@ TestResource::~TestResource()
void TestResource::init()
{
- resource = new Resource(MediaClass, RP_FLAGS_AUDIO|RP_FLAGS_VIDEO, this);
+ resource = new Resource(MediaClass, AudioResource|VideoResource, this);
resourceLibrary = new MockResourceLibrary(resource, false, false);
QVERIFY(resource != NULL);
- QVERIFY(resource->resourceClass == MediaClass);
- QVERIFY(resource->flags == (RP_FLAGS_AUDIO|RP_FLAGS_VIDEO));
- qDebug("INIT!");
+ QVERIFY(resource->applicationClass() == MediaClass);
+ QVERIFY(resource->resources() == (AudioResource|VideoResource));
+ QVERIFY(resource->hasExclusiveAccess() == false);
+ QVERIFY(resource->hasResource(AudioResource));
+ QVERIFY(resource->hasResource(VideoResource));
+}
+
+void TestResource::testApplicationClass()
+{
+ enum ResourceClass expected, actual;
+
+ expected = MediaClass;
+ actual = resource->applicationClass();
+
+ QVERIFY(actual == expected);
+}
+
+void TestResource::testResources()
+{
+ quint16 expected, actual;
+
+ expected = AudioResource|VideoResource;
+ actual = resource->resources();
+
+ QVERIFY(actual == expected);
}
void TestResource::testInitializeSucceeds()
diff --git a/tests/test-resource.h b/tests/test-resource.h
index 295d6d3..6a39ad4 100644
--- a/tests/test-resource.h
+++ b/tests/test-resource.h
@@ -22,6 +22,9 @@ private slots:
void testConnectToServerSucceeds();
void testConnectToServerFails();
+
+ void testApplicationClass();
+ void testResources();
};
#endif