aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-04-18 15:00:01 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:54:12 -0300
commit26be28d120aba5401e8e4ed0509557070729cb82 (patch)
tree5cbd30ec50071404ef7407961b795b0cfb659a30
parent2b0c31fb027bada0f641a320add7009d0ee61f0a (diff)
Fixed test to avoid problems with float numbers in different archs.
Reviewer: Luciano Wolf <luciano.wolf@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
-rw-r--r--tests/QtGui/returnquadruplesofnumbers_test.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/QtGui/returnquadruplesofnumbers_test.py b/tests/QtGui/returnquadruplesofnumbers_test.py
index a5fd9b3b2..a1b446e00 100644
--- a/tests/QtGui/returnquadruplesofnumbers_test.py
+++ b/tests/QtGui/returnquadruplesofnumbers_test.py
@@ -16,28 +16,33 @@ class GraphicsLayoutItem(QGraphicsLayoutItem):
QGraphicsLayoutItem.__init__(self)
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):
obj = GraphicsLayout()
values = (10.0, 20.0, 30.0, 40.0)
obj.setContentsMargins(*values)
- self.assertEquals(round(obj.getContentsMargins()), values)
+ self.assert_(self.compareTuples(obj.getContentsMargins(), values))
def testQGraphicsLayoutItemGetContentsMargins(self):
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):
obj = QWidget()
values = (10, 20, 30, 40)
obj.setContentsMargins(*values)
- self.assertEquals(round(obj.getContentsMargins()), values)
+ self.assert_(self.compareTuples(obj.getContentsMargins(), values))
def testQLayoutGetContentsMargins(self):
obj = Layout()
values = (10, 20, 30, 40)
obj.setContentsMargins(*values)
- self.assertEquals(round(obj.getContentsMargins()), values)
+ self.assert_(self.compareTuples(obj.getContentsMargins(), values))
def testQTextCursorSelectedTableCells(self):
obj = QTextCursor()
@@ -48,7 +53,7 @@ class ReturnsQuadruplesOfNumbers(UsesQApplication):
obj = QPrinter()
values = (10.0, 20.0, 30.0, 40.0, QPrinter.Point)
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__":
unittest.main()