Created unit test to QKeySequence convertion to QVariant.
Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Hugo Parente Lima <hugo.pl@gmail.com>
This commit is contained in:
parent
5d3285e41d
commit
50e6f9690b
3 changed files with 20 additions and 0 deletions
|
|
@ -78,6 +78,7 @@ PYSIDE_TEST(delegatecreateseditor_test.py)
|
||||||
PYSIDE_TEST(homonymoussignalandmethod_test.py)
|
PYSIDE_TEST(homonymoussignalandmethod_test.py)
|
||||||
PYSIDE_TEST(list_signal_test.py)
|
PYSIDE_TEST(list_signal_test.py)
|
||||||
PYSIDE_TEST(modelview_test.py)
|
PYSIDE_TEST(modelview_test.py)
|
||||||
|
PYSIDE_TEST(qvariant_test.py)
|
||||||
PYSIDE_TEST(signalandnamespace_test.py)
|
PYSIDE_TEST(signalandnamespace_test.py)
|
||||||
PYSIDE_TEST(signalwithdefaultvalue_test.py)
|
PYSIDE_TEST(signalwithdefaultvalue_test.py)
|
||||||
PYSIDE_TEST(signalemissionfrompython_test.py)
|
PYSIDE_TEST(signalemissionfrompython_test.py)
|
||||||
|
|
|
||||||
17
tests/pysidetest/qvariant_test.py
Normal file
17
tests/pysidetest/qvariant_test.py
Normal file
|
|
@ -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()
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
|
#include <QVariant>
|
||||||
#ifdef pysidetest_EXPORTS
|
#ifdef pysidetest_EXPORTS
|
||||||
#define PYSIDE_EXPORTS 1
|
#define PYSIDE_EXPORTS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -14,6 +15,7 @@ class PYSIDE_API TestObject : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
static void createApp() { int argc=0; new QApplication(argc, 0); };
|
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) {}
|
TestObject(int idValue, QObject* parent = 0) : QObject(parent), m_idValue(idValue) {}
|
||||||
int idValue() const { return m_idValue; }
|
int idValue() const { return m_idValue; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue