## information to ensure the GNU General Public License requirements will ## be met: https://www.gnu.org/licenses/gpl-3.0.html. ## ## $QT_END_LICENSE$ ## ############################################################################# ''' Test bug 688: http://bugs.openbossa.org/show_bug.cgi?id=688''' import os import sys import unittest sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from init_paths import init_test_paths init_test_paths(False) from helper.usesqapplication import UsesQApplication from PySide2.QtGui import QTextFrame, QTextCursor, QTextCharFormat, QFont, QTextFrameFormat from PySide2.QtWidgets import QTextEdit class BugTest(UsesQApplication): def testCase(self): editor = QTextEdit() cursor = QTextCursor(editor.textCursor()) cursor.movePosition(QTextCursor.Start) mainFrame = cursor.currentFrame() plainCharFormat = QTextCharFormat() boldCharFormat = QTextCharFormat()
## information to ensure the GNU General Public License requirements will ## be met: https://www.gnu.org/licenses/gpl-3.0.html. ## ## $QT_END_LICENSE$ ## ############################################################################# import os import sys sys.path.append( os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "util")) sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from init_paths import init_test_paths init_test_paths() from PySide2.QtCore import QTimer, QPointF from PySide2.QtWidgets import QApplication, QGraphicsView, QGraphicsScene, QGraphicsEllipseItem class Ball(QGraphicsEllipseItem): def __init__(self, d, parent=None): super(Ball, self).__init__(0, 0, d, d, parent) self.vel = QPointF(0, 0) #commenting this out prevents the crash class Foo(QGraphicsView): def __init__(self): super(Foo, self).__init__(None) self.scene = QGraphicsScene(self.rect())
## included in the packaging of this file. Please review the following ## information to ensure the GNU General Public License requirements will ## be met: https://www.gnu.org/licenses/gpl-2.0.html and ## https://www.gnu.org/licenses/gpl-3.0.html. ## ## $QT_END_LICENSE$ ## ############################################################################# import os import sys import unittest sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from init_paths import init_test_paths init_test_paths(True) from testbinding import PySideCPP, TestObject class QObjectDerivedReprTest(unittest.TestCase): """Test the __repr__ implementation of QObject derived classes""" def testReprWithoutNamespace(self): """Test that classes outside a namespace that have a operator<<(QDebug,...) defined use that for __repr__""" t = TestObject(123) # We don't define __str__, so str(q) should call __repr__ self.assertEqual(t.__repr__(), str(t)) # __repr__ should use the operator<<(QDebug,...) implementation