Changeset c8b88546b90e…
Parent 461390733a05…
by
Changes to one file · Browse files at c8b88546b90e Showing diff from parent 461390733a05 Diff from another changeset...
@@ -104,7 +104,7 @@ def rowCount(self):
"""
Tests self.model's implementation of QtCore.QAbstractItemModel::rowCount() and hasChildren()
-
+
self.models that are dynamically populated are not as fully tested here.
"""
# check top row
@@ -121,7 +121,7 @@ assert(rows >= 0)
if rows > 0:
assert(self.model.hasChildren(secondlvl) == True)
-
+
# The self.models rowCount() is tested more extensively in checkChildren,
# but this catches the big mistakes
@@ -256,7 +256,7 @@ variant = self.model.data(self.model.index(0,0,QtCore.QModelIndex()), QtCore.Qt.WhatsThisRole)
if variant.isValid():
assert( variant.canConvert( QtCore.QVariant.String ) )
-
+
# General Purpose roles that should return a QSize
variant = self.model.data(self.model.index(0,0,QtCore.QModelIndex()), QtCore.Qt.SizeHintRole)
if variant.isValid():
@@ -266,15 +266,12 @@ variant = self.model.data(self.model.index(0,0,QtCore.QModelIndex()), QtCore.Qt.FontRole)
if variant.isValid():
assert( variant.canConvert( QtCore.QVariant.Font ) )
-
+
# Check that the alignment is one we know about
variant = self.model.data(self.model.index(0,0,QtCore.QModelIndex()), QtCore.Qt.TextAlignmentRole)
if variant.isValid():
alignment = variant.toInt()[0]
- assert( alignment == QtCore.Qt.AlignLeft or
- alignment == QtCore.Qt.AlignRight or
- alignment == QtCore.Qt.AlignHCenter or
- alignment == QtCore.Qt.AlignJustify)
+ assert( alignment == (alignment & int(QtCore.Qt.AlignHorizontal_Mask | QtCore.Qt.AlignVertical_Mask)))
# General Purpose roles that should return a QColor
variant = self.model.data(self.model.index(0,0,QtCore.QModelIndex()), QtCore.Qt.BackgroundColorRole)
@@ -322,7 +319,7 @@ c = self.insert.pop()
assert(c['parent'] == parent)
assert(c['oldSize'] + (end - start + 1) == self.model.rowCount(parent))
- assert(c['last'] == self.model.data(model.index(start-1, 0, c['parent'])))
+ assert(c['last'] == self.model.data(self.model.index(start-1, 0, c['parent'])))
# if c['next'] != self.model.data(model.index(end+1, 0, c['parent'])):
# qDebug << start << end
@@ -339,19 +336,19 @@ c = {}
c['parent'] = parent
c['oldSize'] = self.model.rowCount(parent)
- c['last'] = self.model.data(model.index(start-1, 0, parent))
- c['next'] = self.model.data(model.index(end+1, 0, parent))
- remove.append(c)
+ c['last'] = self.model.data(self.model.index(start-1, 0, parent))
+ c['next'] = self.model.data(self.model.index(end+1, 0, parent))
+ self.remove.append(c)
def rowsRemoved(self, parent, start, end):
"""
Confirm that what was said was going to happen actually did
"""
- c = remove.pop()
+ c = self.remove.pop()
assert(c['parent'] == parent)
assert(c['oldSize'] - (end - start + 1) == self.model.rowCount(parent))
- assert(c['last'] == self.model.data(model.index(start-1, 0, c['parent'])))
- assert(c['next'] == self.model.data(model.index(start, 0, c['parent'])))
+ assert(c['last'] == self.model.data(self.model.index(start-1, 0, c['parent'])))
+ assert(c['next'] == self.model.data(self.model.index(start, 0, c['parent'])))
def checkChildren(self, parent, depth = 0):
"""
|
Loading...