예제 #1
0
class TestLocationFinderFilter(unittest.TestCase):
    def setUp(self):
        self.gui = GUI(GeistFakeBackend())

    def test_filter(self):
        in_location = self.gui.wait_find_one(Location(10, 10, 100, 100))
        parent_x, parent_y = 40, 50
        child_x, child_y = 100, 17
        finder = FinderInFinder(Location(child_x, child_y, 100, 100), Location(parent_x, parent_y, 500, 500))
        result = self.gui.wait_find_one(finder)
        self.assertEqual(parent_x + child_x, result.x)
        self.assertEqual(parent_y + child_y, result.y)
예제 #2
0
class TestLocationFinderFilter(unittest.TestCase):
    def setUp(self):
        self.gui = GUI(GeistFakeBackend())

    def test_filter(self):
        in_location = self.gui.wait_find_one(Location(10, 10, 100, 100))
        parent_x, parent_y = 40, 50
        child_x, child_y = 100, 17
        finder = FinderInFinder(Location(child_x, child_y, 100, 100),
                                Location(parent_x, parent_y, 500, 500))
        result = self.gui.wait_find_one(finder)
        self.assertEqual(parent_x + child_x, result.x)
        self.assertEqual(parent_y + child_y, result.y)
예제 #3
0
 def test_nontrivial_StopChangingFinder(self):
     backend = GeistFakeBackend(image=np.array([[[0], [0]], [[0], [0]]]))
     gui = GUI(backend)
     finder = StopChangingFinder(self.location)
     #backend.image = np.array([[[0],[0]],[[0],[0]]])
     finder.period = 1
     location_found = gui.wait_find_one(finder)
     self.assertTrue(np.array_equal(location_found.image, backend.image))
예제 #4
0
 def test_nontrivial_StopChangingFinder(self):
     backend = GeistFakeBackend(image=np.array([[[0], [0]], [[0], [0]]]))
     gui = GUI(backend)
     finder = StopChangingFinder(self.location)
     # backend.image = np.array([[[0],[0]],[[0],[0]]])
     finder.period = 1
     location_found = gui.wait_find_one(finder)
     self.assertTrue(np.array_equal(location_found.image, backend.image))