summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2010-12-22 16:14:47 -0300
committerRenato Araujo Oliveira Filho <renato.filho@openbossa.org>2010-12-22 16:34:29 -0300
commitc4185280ba22615b57632aa81155a6c6c782a7d7 (patch)
treee72bbe07d67280f13e07d8dccb14504d20bc4aae
parent4b0eaa779651e9de4737c73bde4b911cc7db6527 (diff)
downloadpyside-c4185280ba22615b57632aa81155a6c6c782a7d7.tar.gz
pyside-c4185280ba22615b57632aa81155a6c6c782a7d7.tar.xz
pyside-c4185280ba22615b57632aa81155a6c6c782a7d7.zip
Moved list_signal_test to pysidetest library.
This isolate the test case, and avoid other problems with X during the buildbot compilation. Reviewer: Lauro Moura <lauro.neto@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
-rw-r--r--tests/pysidetest/CMakeLists.txt1
-rw-r--r--tests/pysidetest/list_signal_test.py23
-rw-r--r--tests/pysidetest/testobject.h3
-rw-r--r--tests/signals/CMakeLists.txt1
-rw-r--r--tests/signals/list_signal_test.py35
5 files changed, 27 insertions, 36 deletions
diff --git a/tests/pysidetest/CMakeLists.txt b/tests/pysidetest/CMakeLists.txt
index 4a4c27a..b3215bc 100644
--- a/tests/pysidetest/CMakeLists.txt
+++ b/tests/pysidetest/CMakeLists.txt
@@ -76,4 +76,5 @@ PYSIDE_TEST(homonymoussignalandmethod_test.py)
PYSIDE_TEST(delegatecreateseditor_test.py)
PYSIDE_TEST(modelview_test.py)
PYSIDE_TEST(version_test.py)
+PYSIDE_TEST(list_signal_test.py)
diff --git a/tests/pysidetest/list_signal_test.py b/tests/pysidetest/list_signal_test.py
new file mode 100644
index 0000000..36d3c21
--- /dev/null
+++ b/tests/pysidetest/list_signal_test.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+
+import unittest
+from testbinding import TestObject
+from PySide.QtCore import QObject
+
+class ListConnectionTest(unittest.TestCase):
+
+ def childrenChanged(self, children):
+ self._child = children[0]
+
+ def testConnection(self):
+ o = TestObject(0)
+ c = QObject()
+ c.setObjectName("child")
+ self._child = None
+ o.childrenChanged.connect(self.childrenChanged)
+ o.addChild(c)
+ self.assertEquals(self._child.objectName(), "child")
+
+if __name__ == '__main__':
+ unittest.main()
+
diff --git a/tests/pysidetest/testobject.h b/tests/pysidetest/testobject.h
index 9012359..d882870 100644
--- a/tests/pysidetest/testobject.h
+++ b/tests/pysidetest/testobject.h
@@ -14,6 +14,7 @@ public:
TestObject(int idValue, QObject* parent = 0) : QObject(parent), m_idValue(idValue) {}
int idValue() const { return m_idValue; }
static int staticMethodDouble(int value) { return value * 2; }
+ void addChild(QObject* c) { m_children.append(c); emit childrenChanged(m_children); }
void emitIdValueSignal();
void emitStaticMethodDoubleSignal();
@@ -22,9 +23,11 @@ signals:
void idValue(int newValue);
void justASignal();
void staticMethodDouble();
+ void childrenChanged(const QList<QObject*>);
private:
int m_idValue;
+ QList<QObject*> m_children;
};
#endif // TESTOBJECT_H
diff --git a/tests/signals/CMakeLists.txt b/tests/signals/CMakeLists.txt
index cad84f1..c9ef33e 100644
--- a/tests/signals/CMakeLists.txt
+++ b/tests/signals/CMakeLists.txt
@@ -6,7 +6,6 @@ PYSIDE_TEST(decorators_test.py)
PYSIDE_TEST(invalid_callback_test.py)
PYSIDE_TEST(lambda_gui_test.py)
PYSIDE_TEST(lambda_test.py)
-PYSIDE_TEST(list_signal_test.py)
PYSIDE_TEST(leaking_signal_test.py)
PYSIDE_TEST(multiple_connections_gui_test.py)
PYSIDE_TEST(multiple_connections_test.py)
diff --git a/tests/signals/list_signal_test.py b/tests/signals/list_signal_test.py
deleted file mode 100644
index c65eb11..0000000
--- a/tests/signals/list_signal_test.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- coding: utf-8 -*-
-
-import unittest
-
-from PySide.QtCore import *
-from PySide.QtGui import *
-
-class ListConnectionTest(unittest.TestCase):
-
- def modifyScene(self):
- self.scene.addLine(0, 0, 10, 10)
-
- def sceneChanged(self, rects):
- # Qt isn't so cute and sends this signal with empty lists and null rects sometimes.
- if len(rects) > 0 and not rects[0].isNull():
- self.rects = rects
- QApplication.quit()
-
- def testConnection(self):
- app = QApplication([])
-
- self.scene = QGraphicsScene()
- QTimer.singleShot(0, self.modifyScene)
- self.scene.changed.connect(self.sceneChanged)
-
- app.exec_()
- self.assertEquals(len(self.rects), 1)
- self.assertEquals(self.rects[0].x(), 0)
- self.assertEquals(self.rects[0].y(), 0)
- self.assertEquals(self.rects[0].width(), 10)
- self.assertEquals(self.rects[0].height(), 10)
-
-if __name__ == '__main__':
- unittest.main()
-