summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-01-11 13:07:22 +0200
committerWolf Bergenheim <ext-wolf.2.bergenheim@nokia.com>2010-01-11 13:07:22 +0200
commit16e168be787858303c33756c3895b3ec4a9ad2de (patch)
treef4b015e4afa70ba7718cd21b895e16c871eb7337 /tests
parent60e514250464d6b563ab92b19bf717e57d7b6a52 (diff)
downloadlibresourceqt-16e168be787858303c33756c3895b3ec4a9ad2de.tar.gz
API documentation
Diffstat (limited to 'tests')
-rw-r--r--tests/test-libplayback.make303
-rw-r--r--tests/test-resource.cpp22
-rw-r--r--tests/test-resource.h5
3 files changed, 26 insertions, 304 deletions
diff --git a/tests/test-libplayback.make b/tests/test-libplayback.make
deleted file mode 100644
index 8946476..0000000
--- a/tests/test-libplayback.make
+++ /dev/null
@@ -1,303 +0,0 @@
-#############################################################################
-# Makefile for building: build/test-libplayback
-# 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
-#############################################################################
-
-####### Compiler, tools and options
-
-CC = gcc
-CXX = g++
-DEFINES = -DQT_DBUS_LIB -DQT_CORE_LIB -DQT_SHARED
-CFLAGS = -pipe -g -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/libplayback-1 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -Wall -W -D_REENTRANT $(DEFINES)
-CXXFLAGS = -pipe -g -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/libplayback-1 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -Wall -W -D_REENTRANT $(DEFINES)
-INCPATH = -I/targets/maemo6-armv7/usr/share/qt4/mkspecs/linux-g++-gles2 -I. -I/targets/maemo6-armv7/usr/include/qt4/QtCore -I/targets/maemo6-armv7/usr/include/qt4/QtDBus -I/targets/maemo6-armv7/usr/include/qt4 -I/targets/maemo6-armv7/usr/include/qt4/QtTest -I../src -I../include -Ibuild
-LINK = g++
-LFLAGS = -Wl,-rpath-link=/lib -Wl,-rpath-link=/usr/lib -Wl,-rpath-link=/usr/local/lib -Wl,-rpath-link=/usr/X11R6/lib
-LIBS = $(SUBLIBS) -L/usr/lib -lplayback-1 -ldbus-1 -lrt -lQtTest -lQtDBus -lQtCore -lpthread
-AR = ar cqs
-RANLIB =
-QMAKE = /usr/bin/qmake
-TAR = tar -cf
-COMPRESS = gzip -9f
-COPY = cp -f
-SED = sed
-COPY_FILE = $(COPY)
-COPY_DIR = $(COPY) -r
-STRIP = strip
-INSTALL_FILE = install -m 644 -p
-INSTALL_DIR = $(COPY_DIR)
-INSTALL_PROGRAM = install -m 755 -p
-DEL_FILE = rm -f
-SYMLINK = ln -sf
-DEL_DIR = rmdir
-MOVE = mv -f
-CHK_DIR_EXISTS= test -d
-MKDIR = mkdir -p
-
-####### Output directory
-
-OBJECTS_DIR = build/
-
-####### Files
-
-SOURCES = test-libplayback.cpp \
- ../src/libplayback-wrapper.cpp \
- ../src/resource.cpp \
- ../src/resource-factory.cpp build/moc_test-libplayback.cpp \
- build/moc_resource.cpp \
- build/moc_resource-factory.cpp \
- build/moc_libplayback-wrapper.cpp
-OBJECTS = build/test-libplayback.o \
- build/libplayback-wrapper.o \
- build/resource.o \
- build/resource-factory.o \
- build/moc_test-libplayback.o \
- build/moc_resource.o \
- build/moc_resource-factory.o \
- build/moc_libplayback-wrapper.o
-DIST = /targets/maemo6-armv7/usr/share/qt4/mkspecs/common/g++.conf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/common/unix.conf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/common/linux.conf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/qconfig.pri \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/qt_functions.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/qt_config.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/default_pre.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/debug.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/default_post.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/link_pkgconfig.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/warn_on.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/qtestlib.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/qt.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/moc.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/dbusinterfaces.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/dbusadaptors.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/unix/thread.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/resources.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/uic.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/yacc.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/lex.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/include_source_dir.prf \
- test-libplayback.pro
-QMAKE_TARGET = test-libplayback
-DESTDIR = build/
-TARGET = build/test-libplayback
-
-first: all
-####### Implicit rules
-
-.SUFFIXES: .o .c .cpp .cc .cxx .C
-
-.cpp.o:
- $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
-
-.cc.o:
- $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
-
-.cxx.o:
- $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
-
-.C.o:
- $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
-
-.c.o:
- $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
-
-####### Build rules
-
-all: test-libplayback.make $(TARGET)
-
-$(TARGET): $(OBJECTS)
- @$(CHK_DIR_EXISTS) build/ || $(MKDIR) build/
- $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
-
-test-libplayback.make: test-libplayback.pro /targets/maemo6-armv7/usr/share/qt4/mkspecs/linux-g++-gles2/qmake.conf /targets/maemo6-armv7/usr/share/qt4/mkspecs/common/g++.conf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/common/unix.conf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/common/linux.conf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/qconfig.pri \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/qt_functions.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/qt_config.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/default_pre.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/debug.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/default_post.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/link_pkgconfig.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/warn_on.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/qtestlib.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/qt.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/moc.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/dbusinterfaces.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/dbusadaptors.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/unix/thread.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/resources.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/uic.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/yacc.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/lex.prf \
- /targets/maemo6-armv7/usr/share/qt4/mkspecs/features/include_source_dir.prf \
- /usr/lib/libQtTest.prl \
- /usr/lib/libQtDBus.prl \
- /usr/lib/libQtCore.prl
- $(QMAKE) -unix -o test-libplayback.make test-libplayback.pro
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/common/g++.conf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/common/unix.conf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/common/linux.conf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/qconfig.pri:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/qt_functions.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/qt_config.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/default_pre.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/debug.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/default_post.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/link_pkgconfig.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/warn_on.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/qtestlib.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/qt.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/moc.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/dbusinterfaces.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/dbusadaptors.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/unix/thread.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/resources.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/uic.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/yacc.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/lex.prf:
-/targets/maemo6-armv7/usr/share/qt4/mkspecs/features/include_source_dir.prf:
-/usr/lib/libQtTest.prl:
-/usr/lib/libQtDBus.prl:
-/usr/lib/libQtCore.prl:
-qmake: FORCE
- @$(QMAKE) -unix -o test-libplayback.make test-libplayback.pro
-
-dist:
- @$(CHK_DIR_EXISTS) build/test-libplayback1.0.0 || $(MKDIR) build/test-libplayback1.0.0
- $(COPY_FILE) --parents $(SOURCES) $(DIST) build/test-libplayback1.0.0/ && $(COPY_FILE) --parents test-libplayback.h ../include/resource.h ../include/resource-factory.h ../include/resource-types.h ../src/libplayback-wrapper.h ../src/resource-library.h build/test-libplayback1.0.0/ && $(COPY_FILE) --parents test-libplayback.cpp ../src/libplayback-wrapper.cpp ../src/resource.cpp ../src/resource-factory.cpp build/test-libplayback1.0.0/ && (cd `dirname build/test-libplayback1.0.0` && $(TAR) test-libplayback1.0.0.tar test-libplayback1.0.0 && $(COMPRESS) test-libplayback1.0.0.tar) && $(MOVE) `dirname build/test-libplayback1.0.0`/test-libplayback1.0.0.tar.gz . && $(DEL_FILE) -r build/test-libplayback1.0.0
-
-
-clean:compiler_clean
- -$(DEL_FILE) $(OBJECTS)
- -$(DEL_FILE) *~ core *.core
-
-
-####### Sub-libraries
-
-distclean: clean
- -$(DEL_FILE) $(TARGET)
- -$(DEL_FILE) test-libplayback.make
-
-
-mocclean: compiler_moc_header_clean compiler_moc_source_clean
-
-mocables: compiler_moc_header_make_all compiler_moc_source_make_all
-
-compiler_moc_header_make_all: build/moc_test-libplayback.cpp build/moc_resource.cpp build/moc_resource-factory.cpp build/moc_libplayback-wrapper.cpp
-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
-
-build/moc_resource.cpp: ../src/resource-library.h \
- ../include/resource-types.h \
- ../include/resource.h
- /usr/bin/moc $(DEFINES) $(INCPATH) ../include/resource.h -o build/moc_resource.cpp
-
-build/moc_resource-factory.cpp: ../include/resource-types.h \
- ../include/resource-factory.h
- /usr/bin/moc $(DEFINES) $(INCPATH) ../include/resource-factory.h -o build/moc_resource-factory.cpp
-
-build/moc_libplayback-wrapper.cpp: ../src/resource-library.h \
- ../include/resource.h \
- ../include/resource-types.h \
- ../src/libplayback-wrapper.h
- /usr/bin/moc $(DEFINES) $(INCPATH) ../src/libplayback-wrapper.h -o build/moc_libplayback-wrapper.cpp
-
-compiler_dbus_interface_source_make_all:
-compiler_dbus_interface_source_clean:
-compiler_dbus_adaptor_source_make_all:
-compiler_dbus_adaptor_source_clean:
-compiler_rcc_make_all:
-compiler_rcc_clean:
-compiler_image_collection_make_all: qmake_image_collection.cpp
-compiler_image_collection_clean:
- -$(DEL_FILE) qmake_image_collection.cpp
-compiler_moc_source_make_all:
-compiler_moc_source_clean:
-compiler_dbus_interface_header_make_all:
-compiler_dbus_interface_header_clean:
-compiler_dbus_interface_moc_make_all:
-compiler_dbus_interface_moc_clean:
-compiler_dbus_adaptor_header_make_all:
-compiler_dbus_adaptor_header_clean:
-compiler_dbus_adaptor_moc_make_all:
-compiler_dbus_adaptor_moc_clean:
-compiler_uic_make_all:
-compiler_uic_clean:
-compiler_yacc_decl_make_all:
-compiler_yacc_decl_clean:
-compiler_yacc_impl_make_all:
-compiler_yacc_impl_clean:
-compiler_lex_make_all:
-compiler_lex_clean:
-compiler_clean: compiler_moc_header_clean
-
-####### Compile
-
-build/test-libplayback.o: test-libplayback.cpp test-libplayback.h \
- ../include/resource-factory.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 \
- ../src/resource-library.h \
- ../include/resource.h \
- ../include/resource-types.h
- $(CXX) -c $(CXXFLAGS) $(INCPATH) -o build/libplayback-wrapper.o ../src/libplayback-wrapper.cpp
-
-build/resource.o: ../src/resource.cpp ../include/resource.h \
- ../src/resource-library.h \
- ../include/resource-types.h
- $(CXX) -c $(CXXFLAGS) $(INCPATH) -o build/resource.o ../src/resource.cpp
-
-build/resource-factory.o: ../src/resource-factory.cpp ../include/resource-factory.h \
- ../include/resource-types.h \
- ../src/libplayback-wrapper.h \
- ../src/resource-library.h \
- ../include/resource.h
- $(CXX) -c $(CXXFLAGS) $(INCPATH) -o build/resource-factory.o ../src/resource-factory.cpp
-
-build/moc_test-libplayback.o: build/moc_test-libplayback.cpp
- $(CXX) -c $(CXXFLAGS) $(INCPATH) -o build/moc_test-libplayback.o build/moc_test-libplayback.cpp
-
-build/moc_resource.o: build/moc_resource.cpp
- $(CXX) -c $(CXXFLAGS) $(INCPATH) -o build/moc_resource.o build/moc_resource.cpp
-
-build/moc_resource-factory.o: build/moc_resource-factory.cpp
- $(CXX) -c $(CXXFLAGS) $(INCPATH) -o build/moc_resource-factory.o build/moc_resource-factory.cpp
-
-build/moc_libplayback-wrapper.o: build/moc_libplayback-wrapper.cpp
- $(CXX) -c $(CXXFLAGS) $(INCPATH) -o build/moc_libplayback-wrapper.o build/moc_libplayback-wrapper.cpp
-
-####### Install
-
-install_target: first FORCE
- @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/share/libresourceqt/tests/ || $(MKDIR) $(INSTALL_ROOT)/usr/share/libresourceqt/tests/
- -$(INSTALL_PROGRAM) "build/$(QMAKE_TARGET)" "$(INSTALL_ROOT)/usr/share/libresourceqt/tests/$(QMAKE_TARGET)"
-
-uninstall_target: FORCE
- -$(DEL_FILE) "$(INSTALL_ROOT)/usr/share/libresourceqt/tests/$(QMAKE_TARGET)"
- -$(DEL_DIR) $(INSTALL_ROOT)/usr/share/libresourceqt/tests/
-
-
-install: install_target FORCE
-
-uninstall: uninstall_target FORCE
-
-FORCE:
-
diff --git a/tests/test-resource.cpp b/tests/test-resource.cpp
index 8f2e52e..49c43b0 100644
--- a/tests/test-resource.cpp
+++ b/tests/test-resource.cpp
@@ -3,6 +3,7 @@
using namespace ResourceTypes;
TestResource::TestResource()
+ : isReservable(false)
{
}
@@ -17,7 +18,7 @@ void TestResource::init()
QVERIFY(resource != NULL);
QVERIFY(resource->applicationClass() == MediaClass);
QVERIFY(resource->resources() == (AudioResource|VideoResource));
- QVERIFY(resource->hasExclusiveAccess() == false);
+ QVERIFY(resource->isReserved() == false);
QVERIFY(resource->hasResource(AudioResource));
QVERIFY(resource->hasResource(VideoResource));
}
@@ -90,4 +91,23 @@ void TestResource::testConnectToServerFails()
QVERIFY(connectToServerSucceeded);
}
+// testStateChanged
+
+void TestResource::testReservable()
+{
+ resource->initialize(resourceLibrary);
+ resource->connectToServer();
+
+ QObject::connect(resource, SIGNAL(reservable()), this, SLOT(handleReservable()));
+
+ resource->emitReservable();
+
+ QVERIFY(isReservable);
+}
+
+void TestResource::handleReservable()
+{
+ isReservable = true;
+}
+
QTEST_MAIN(TestResource)
diff --git a/tests/test-resource.h b/tests/test-resource.h
index 6a39ad4..9028ccd 100644
--- a/tests/test-resource.h
+++ b/tests/test-resource.h
@@ -11,6 +11,8 @@ class TestResource: public QObject
private:
ResourceLibrary *resourceLibrary;
Resource *resource;
+
+ bool isReservable;
public:
TestResource();
~TestResource();
@@ -25,6 +27,9 @@ private slots:
void testApplicationClass();
void testResources();
+
+ void testReservable();
+ void handleReservable();
};
#endif