Ejemplo n.º 1
0
 def testMult_TypeErrorWithInvalidOperands(self):
     # pylint: disable=pointless-statement
     p = g.Point(1, 2)
     q = g.Point(2, 4)
     with self.assertRaises(TypeError):
         p * q  # Can't multiply points.
     with self.assertRaises(TypeError):
         p * 4  # Can't multiply by a scalar on the right.
Ejemplo n.º 2
0
 def testFromJson(self):
     r1 = g.Rectangle(g.Point(0, 1), g.Point(2, 3))
     r2 = g.Rectangle.FromDict({
         'top': 1,
         'left': 0,
         'bottom': 3,
         'right': 2
     })
     self.assertEquals(r1, r2)
Ejemplo n.º 3
0
 def testAdd_TypeErrorWithInvalidOperands(self):
     # pylint: disable=pointless-statement
     p = g.Point(1, 2)
     with self.assertRaises(TypeError):
         p + 4  # Can't add point and scalar.
     with self.assertRaises(TypeError):
         4 + p  # Can't add scalar and point.
Ejemplo n.º 4
0
 def testTap_withOffsetInDp(self):
     node = self.app.GetUiNode(content_desc='Open navigation drawer')
     node.Tap(geometry.Point(10, 20), dp_units=True)
     self.assertTappedOnceAt(20, 98)
Ejemplo n.º 5
0
 def testTap_withOffset(self):
     node = self.app.GetUiNode(content_desc='Open navigation drawer')
     node.Tap(geometry.Point(10, 20))
     self.assertTappedOnceAt(10, 78)
Ejemplo n.º 6
0
 def testTap_topleft(self):
     node = self.app.GetUiNode(content_desc='Open navigation drawer')
     node.Tap(geometry.Point(0, 0))
     self.assertTappedOnceAt(0, 58)
Ejemplo n.º 7
0
 def testCenter(self):
     r = g.Rectangle(g.Point(0, 1), g.Point(2, 3))
     c = g.Point(1, 2)
     self.assertEquals(r.center, c)
Ejemplo n.º 8
0
 def testStr(self):
     r = g.Rectangle(g.Point(0, 1), g.Point(2, 3))
     self.assertEquals(str(r), '[(0, 1), (2, 3)]')
Ejemplo n.º 9
0
 def testMult(self):
     p = g.Point(1, 2)
     r = g.Point(2, 4)
     self.assertEquals(2 * p, r)  # Multiply by scalar on the left.
Ejemplo n.º 10
0
 def testAdd(self):
     p = g.Point(1, 2)
     q = g.Point(3, 4)
     r = g.Point(4, 6)
     self.assertEquals(p + q, r)
Ejemplo n.º 11
0
 def testStr(self):
     p = g.Point(1, 2)
     self.assertEquals(str(p), '(1, 2)')