コード例 #1
0
	def test_one(self):
		rects = r1, r2 = R(0, 0, 10, 30), R(10, 10, 20, 10)
		cloud = RectangleCloud(rects)

		# add a rect
		r = R(0, 0, 20, 10)
		cloud.add_rect(r)
		assert r == R(10, 20, 20, 10)
コード例 #2
0
	def test_multiple(self):

		cloud = RectangleCloud()

		# add a rect
		r1 = RECTS[0].clone()

		cloud.add_rect(r1)
		assert r1 == R(0,0,10,10)

		# add next rect
		r2 = RECTS[1].clone()

		cloud.add_rect(r2)

		assert r1 == R(0,0,10,10)
		assert r2 == R(10,0,5,10)
コード例 #3
0
def test_ratio():
	cloud = RectangleCloud()
	cloud.add_rect(RECTS[0].clone())