Permalink
Browse files

novos testes

  • Loading branch information...
tonnycordeiro committed Mar 30, 2012
1 parent ec2a3ae commit 12fe998600b4f0ce59d21fe3be8e1b6ec9b1f776
Showing with 24 additions and 2 deletions.
  1. BIN mockito/dist/mockito-0.5.1-py2.7.egg
  2. +24 −2 test/canvas_unit_test.py
Binary file not shown.
View
@@ -2,7 +2,6 @@
import unittest
sys.path.append('..')
-from mockito.mockito import *
from ink2canvas.canvas import Canvas
class TestCanvas(unittest.TestCase):
@@ -162,7 +161,30 @@ def testsTransform(self):
m11, m12, m21, m22, dx, dy = 1.0, 2.0, 3.0, 4.0, 5.0, 6.0
self.canvas.write("ctx.transform(%f, %f, %f, %f, %f, %f);" % (m11, m12, m21, m22, dx, dy))
self.assertEqual(self.canvas.code[0],"\tctx.transform(%f, %f, %f, %f, %f, %f);\n" % (m11, m12, m21, m22, dx, dy))
+
+ def testRestore(self):
+ text = "ctx.restore();"
+ self.canvas.write(text)
+ self.assertEqual(self.canvas.code[0],"\t"+text+"\n")
+
+ def testClosePath(self):
+ text1, text2, text3 = "ctx.closePath();","ctx.fill();","ctx.stroke();"
+ self.canvas.closePath(False)
+ self.assertEquals(self.canvas.code, [])
+
+ self.canvas.style["fill"] = "none"
+ self.canvas.style["stroke"] = "none"
+ self.canvas.closePath(True)
+ self.assertEqual(self.canvas.code[0],"\t"+text1+"\n")
+ self.canvas.style["fill"] = "fill"
+ self.canvas.style["stroke"] = "stroke"
+ self.canvas.closePath(True)
+ self.assertEqual(self.canvas.code[1],"\t"+text1+"\n")
+ self.assertEqual(self.canvas.code[2],"\t"+text2+"\n")
+ self.assertEqual(self.canvas.code[3],"\t"+text3+"\n")
+
+
if __name__ == '__main__':
unittest.main()
-
+

0 comments on commit 12fe998

Please sign in to comment.