Fixed test to avoid problems with float numbers in different archs.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org>
Marcelo Lira <marcelo.lira@openbossa.org>
This commit is contained in:
parent
e6b3d26d74
commit
3fb374e271
1 changed files with 10 additions and 5 deletions
|
|
@ -16,28 +16,33 @@ class GraphicsLayoutItem(QGraphicsLayoutItem):
|
||||||
QGraphicsLayoutItem.__init__(self)
|
QGraphicsLayoutItem.__init__(self)
|
||||||
|
|
||||||
class ReturnsQuadruplesOfNumbers(UsesQApplication):
|
class ReturnsQuadruplesOfNumbers(UsesQApplication):
|
||||||
|
def compareTuples(self, ta, tb):
|
||||||
|
for va,vb in zip(ta, tb):
|
||||||
|
if round(va) != round(vb):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def testQGraphicsLayoutGetContentsMargins(self):
|
def testQGraphicsLayoutGetContentsMargins(self):
|
||||||
obj = GraphicsLayout()
|
obj = GraphicsLayout()
|
||||||
values = (10.0, 20.0, 30.0, 40.0)
|
values = (10.0, 20.0, 30.0, 40.0)
|
||||||
obj.setContentsMargins(*values)
|
obj.setContentsMargins(*values)
|
||||||
self.assertEquals(round(obj.getContentsMargins()), values)
|
self.assert_(self.compareTuples(obj.getContentsMargins(), values))
|
||||||
|
|
||||||
def testQGraphicsLayoutItemGetContentsMargins(self):
|
def testQGraphicsLayoutItemGetContentsMargins(self):
|
||||||
obj = GraphicsLayoutItem()
|
obj = GraphicsLayoutItem()
|
||||||
self.assertEquals(round(obj.getContentsMargins()), (0.0, 0.0, 0.0, 0.0))
|
self.assert_(self.compareTuples(obj.getContentsMargins(), (0.0, 0.0, 0.0, 0.0)))
|
||||||
|
|
||||||
def testQWidgetGetContentsMargins(self):
|
def testQWidgetGetContentsMargins(self):
|
||||||
obj = QWidget()
|
obj = QWidget()
|
||||||
values = (10, 20, 30, 40)
|
values = (10, 20, 30, 40)
|
||||||
obj.setContentsMargins(*values)
|
obj.setContentsMargins(*values)
|
||||||
self.assertEquals(round(obj.getContentsMargins()), values)
|
self.assert_(self.compareTuples(obj.getContentsMargins(), values))
|
||||||
|
|
||||||
def testQLayoutGetContentsMargins(self):
|
def testQLayoutGetContentsMargins(self):
|
||||||
obj = Layout()
|
obj = Layout()
|
||||||
values = (10, 20, 30, 40)
|
values = (10, 20, 30, 40)
|
||||||
obj.setContentsMargins(*values)
|
obj.setContentsMargins(*values)
|
||||||
self.assertEquals(round(obj.getContentsMargins()), values)
|
self.assert_(self.compareTuples(obj.getContentsMargins(), values))
|
||||||
|
|
||||||
def testQTextCursorSelectedTableCells(self):
|
def testQTextCursorSelectedTableCells(self):
|
||||||
obj = QTextCursor()
|
obj = QTextCursor()
|
||||||
|
|
@ -48,7 +53,7 @@ class ReturnsQuadruplesOfNumbers(UsesQApplication):
|
||||||
obj = QPrinter()
|
obj = QPrinter()
|
||||||
values = (10.0, 20.0, 30.0, 40.0, QPrinter.Point)
|
values = (10.0, 20.0, 30.0, 40.0, QPrinter.Point)
|
||||||
obj.setPageMargins(*values)
|
obj.setPageMargins(*values)
|
||||||
self.assertEquals(round(obj.getPageMargins(QPrinter.Point)), values[:-1])
|
self.assert_(self.compareTuples(obj.getPageMargins(QPrinter.Point), values[:-1]))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue