aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-04-25 15:56:01 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:15 -0300
commit50e6f9690b338a9990eff566c4e49f156e275294 (patch)
treee4a251971c47a3ee4ca2aff4ac5f022f0cb1ce4a /tests
parent5d3285e41d53de399da93ecebcef04b3dc3616ee (diff)
Created unit test to QKeySequence convertion to QVariant.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org> Hugo Parente Lima <hugo.pl@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/pysidetest/CMakeLists.txt1
-rw-r--r--tests/pysidetest/qvariant_test.py17
-rw-r--r--tests/pysidetest/testobject.h2
3 files changed, 20 insertions, 0 deletions
diff --git a/tests/pysidetest/CMakeLists.txt b/tests/pysidetest/CMakeLists.txt
index caa5019bb..aa2411223 100644
--- a/tests/pysidetest/CMakeLists.txt
+++ b/tests/pysidetest/CMakeLists.txt
@@ -78,6 +78,7 @@ PYSIDE_TEST(delegatecreateseditor_test.py)
PYSIDE_TEST(homonymoussignalandmethod_test.py)
PYSIDE_TEST(list_signal_test.py)
PYSIDE_TEST(modelview_test.py)
+PYSIDE_TEST(qvariant_test.py)
PYSIDE_TEST(signalandnamespace_test.py)
PYSIDE_TEST(signalwithdefaultvalue_test.py)
PYSIDE_TEST(signalemissionfrompython_test.py)
diff --git a/tests/pysidetest/qvariant_test.py b/tests/pysidetest/qvariant_test.py
new file mode 100644
index 000000000..d855e2b39
--- /dev/null
+++ b/tests/pysidetest/qvariant_test.py
@@ -0,0 +1,17 @@
+import unittest
+
+from testbinding import TestObject
+from PySide.QtCore import Qt
+from PySide.QtGui import QKeySequence
+
+from helper import UsesQApplication
+
+class QVariantTest(UsesQApplication):
+
+ def testQKeySequenceQVariantOperator(self):
+ # bug #775
+ ks = QKeySequence(Qt.SHIFT, Qt.CTRL, Qt.Key_P, Qt.Key_R)
+ self.assertEqual(TestObject.checkType(ks), 76)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/tests/pysidetest/testobject.h b/tests/pysidetest/testobject.h
index f2cdd5a2b..bfb7edd8b 100644
--- a/tests/pysidetest/testobject.h
+++ b/tests/pysidetest/testobject.h
@@ -4,6 +4,7 @@
#include <QObject>
#include <QApplication>
#include <QMetaType>
+#include <QVariant>
#ifdef pysidetest_EXPORTS
#define PYSIDE_EXPORTS 1
#endif
@@ -14,6 +15,7 @@ class PYSIDE_API TestObject : public QObject
Q_OBJECT
public:
static void createApp() { int argc=0; new QApplication(argc, 0); };
+ static int checkType(const QVariant& var) { return (int)var.type(); }
TestObject(int idValue, QObject* parent = 0) : QObject(parent), m_idValue(idValue) {}
int idValue() const { return m_idValue; }