def testEmpty(self): #QObject.objectName('') name = '' obj = QObject() obj.setObjectName(name) self.assertEqual(name, obj.objectName())
def initialize(self, arguments): self.initializeCalled = True obj = QObject(self) obj.setObjectName("MyPlugin3") self.addAutoReleaseObject(obj) return True, "No error"
def testSimple(self): #QObject.objectName(string) name = 'object1' obj = QObject() obj.setObjectName(name) self.assertEqual(name, obj.objectName())
def testUtf8(self): translator = QTranslator() translator.load(os.path.join(self.trdir, 'trans_russian.qm')) self.app.installTranslator(translator) obj = QObject() obj.setObjectName(obj.trUtf8('Hello World!')) self.assertEqual(obj.objectName(), py3k.unicode_('привет мир!'))
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")
def testLatin(self): #Set string value to Latin translator = QTranslator() translator.load(os.path.join(self.trdir, 'trans_latin.qm')) self.app.installTranslator(translator) obj = QObject() obj.setObjectName(obj.tr('Hello World!')) self.assertEqual(obj.objectName(), py3k.unicode_('Orbis, te saluto!'))
def initialize(self, arguments): self.initializeCalled = False obj = QObject(self) obj.setObjectName("MyPlugin1") self.addAutoReleaseObject(obj) found2 = False found3 = False for otherPluginObj in PluginManager.getInstance().allObjects(): if otherPluginObj.objectName() == "MyPlugin2": found2 = True elif otherPluginObj.objectName() == "MyPlugin3": found3 = True if found2 and found3: return True, "No error" errorString = "object(s) missing from plugin(s):" if not found2: errorString += "plugin2" if not found3: errorString += "plugin3" return False, errorString
def testQStringDefault(self): obj = QObject() obj.setObjectName('foo') self.assertEqual(obj.objectName(), py3k.unicode_('foo')) obj.setObjectName(py3k.unicode_('áâãà')) self.assertEqual(obj.objectName(), py3k.unicode_('áâãà')) obj.setObjectName(None) self.assertEqual(obj.objectName(), py3k.unicode_(''))
def testUnicode(self): name = py3k.unicode_('não') #FIXME Strange error on upstream when using equal(name, obj) obj = QObject() obj.setObjectName(name) self.assertEqual(obj.objectName(), name)
def testSetUnicodeRetrieveUnicode(self): #Set Python unicode string and retrieve unicode obj = QObject() obj.setObjectName(py3k.unicode_('ümlaut')) self.assertEqual(obj.objectName(), py3k.unicode_('ümlaut'))
def testSetRegularStringRetrieveUnicode(self): #Set regular Python string retrieve unicode obj = QObject() obj.setObjectName('test') self.assertEqual(obj.objectName(), py3k.unicode_('test'))
def extensionsInitialized(self): if not self.initializeCalled: return obj = QObject(self) obj.setObjectName("MyPlugin3_running") self.addAutoReleaseObject(obj)