diff options
author | Marcelo Lira <marcelo.lira@openbossa.org> | 2011-06-27 19:08:24 -0300 |
---|---|---|
committer | Marcelo Lira <marcelo.lira@openbossa.org> | 2011-06-27 19:08:24 -0300 |
commit | 52301a1c53c903443cf1459c9e0335077494e667 (patch) | |
tree | 126b31ce763eb5d48aaf7047ca92bf73a1d5c657 | |
parent | 25470abc2a1935a21fb26ab93a10ff9e17905400 (diff) |
Fixed the tests for pyside-rcc and added a new test for bug #901.
-rw-r--r-- | CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/rcc/CMakeLists.txt | 8 | ||||
-rw-r--r-- | tests/rcc/document-print-preview.png | bin | 0 -> 1719 bytes | |||
-rw-r--r-- | tests/rcc/image.qrc | 5 | ||||
-rw-r--r-- | tests/rcc/rcc_image_test.py | 15 | ||||
-rw-r--r-- | tests/rcc/rcc_test.py | 14 | ||||
-rwxr-xr-x | tests/rcc/run_test.sh | 8 |
7 files changed, 40 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1233fc0..bf3264b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,6 +65,7 @@ add_custom_target(dist echo "Source package created at ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.bz2.\n" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) +set(PYSIDERCC_EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/pyrcc/pyside-rcc) add_subdirectory(pyrcc) add_subdirectory(pylupdate) diff --git a/tests/rcc/CMakeLists.txt b/tests/rcc/CMakeLists.txt index 618d0cb..e5e128e 100644 --- a/tests/rcc/CMakeLists.txt +++ b/tests/rcc/CMakeLists.txt @@ -1,6 +1,12 @@ add_test(RccTest ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh - ${PYTHON_EXECUTABLE} + ${PYSIDERCC_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/rcc_test.py ${CMAKE_CURRENT_SOURCE_DIR}/example.qrc ${CMAKE_CURRENT_SOURCE_DIR} ) +add_test(RccImageTest ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh + ${PYSIDERCC_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/rcc_image_test.py + ${CMAKE_CURRENT_SOURCE_DIR}/image.qrc + ${CMAKE_CURRENT_SOURCE_DIR} ) + diff --git a/tests/rcc/document-print-preview.png b/tests/rcc/document-print-preview.png Binary files differnew file mode 100644 index 0000000..772efe5 --- /dev/null +++ b/tests/rcc/document-print-preview.png diff --git a/tests/rcc/image.qrc b/tests/rcc/image.qrc new file mode 100644 index 0000000..c569508 --- /dev/null +++ b/tests/rcc/image.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource> + <file alias="image">document-print-preview.png</file> + </qresource> +</RCC> diff --git a/tests/rcc/rcc_image_test.py b/tests/rcc/rcc_image_test.py new file mode 100644 index 0000000..136d15e --- /dev/null +++ b/tests/rcc/rcc_image_test.py @@ -0,0 +1,15 @@ + +import unittest + +from PySide.QtGui import QApplication, QPixmap + +import image_rc + +class TestRccImage(unittest.TestCase): + def testImage(self): + app = QApplication([]) + image = QPixmap(":image") + self.assertFalse(image.isNull()) + +if __name__ == '__main__': + unittest.main() diff --git a/tests/rcc/rcc_test.py b/tests/rcc/rcc_test.py index affc49f..544804f 100644 --- a/tests/rcc/rcc_test.py +++ b/tests/rcc/rcc_test.py @@ -1,27 +1,29 @@ - +import os import unittest - from PySide.QtCore import QFile - import example_rc class TestRccSimple(unittest.TestCase): + + def setUp(self): + self.testdir = os.path.dirname(__file__) + def testSimple(self): handle = QFile(":words.txt") handle.open(QFile.ReadOnly) - original = open("words.txt", "r") + original = open(os.path.join(self.testdir, "words.txt"), "r") self.assertEqual(handle.readLine(), original.readline()) def testAlias(self): handle = QFile(":jack") handle.open(QFile.ReadOnly) - original = open("shining.txt", "r") + original = open(os.path.join(self.testdir, "shining.txt"), "r") self.assertEqual(handle.readLine(), original.readline()) def testHuge(self): handle = QFile(":manychars.txt") handle.open(QFile.ReadOnly) - original = open("manychars.txt", "r") + original = open(os.path.join(self.testdir, "manychars.txt"), "r") self.assertEqual(handle.readLine(), original.readline()) diff --git a/tests/rcc/run_test.sh b/tests/rcc/run_test.sh index d4a8477..f3b7882 100755 --- a/tests/rcc/run_test.sh +++ b/tests/rcc/run_test.sh @@ -3,11 +3,11 @@ # This is a nasty workaround of a CTest limitation # of setting the environment variables for the test. -# $1: python executable +# $1: pyside-rcc # $2: python test # $3: qrc file export PYTHONPATH=$PYTHONPATH:`pwd` -pyside-rcc -o `basename $3 .qrc`_rc.py $3 -cd $4 -$1 $2 +$1 -o `basename $3 .qrc`_rc.py $3 +`pkg-config shiboken --variable=python_interpreter` $2 + |