Пример #1
0
 def helper_test_ErikaImageRenderingStrategy_real_image(self, strategy):
     """test helper to verify rendering with the given strategy works"""
     with MicrostepBasedErikaMock(
             20, 30, inside_unit_test=True,
             exception_if_overprinted=True) as my_erika:
         renderer = ErikaImageRenderer(
             my_erika, "test: strategy will be set explicitly")
         renderer.render_file_for_fixed_strategy(
             'tests/test_resources/test_image_grayscale_1.bmp', strategy)
         assert_print_output(self, my_erika, [
             "XXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXX",
             "XXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXX",
             "XXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXX",
             "XXXXXXXXXXXXXXXXXXXX", "                    ",
             "                    ", "                    ",
             "                    ", "                    ",
             "                    ", "                    ",
             "                    ", "                    ",
             "                    ", "                    ",
             "                    ", "                    ",
             "                    ", "                    ",
             "XXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXX",
             "XXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXX",
             "XXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXX",
             "XXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXX"
         ])
Пример #2
0
 def helper_test_ErikaImageRenderingStrategy_wide(self, strategy):
     """test helper to verify rendering with the given strategy works"""
     with ErikaMock(9, 4) as my_erika:
         renderer = ErikaImageRenderer(my_erika, strategy)
         renderer.render_ascii_art_file(
             'tests/test_resources/test_ascii_art_small_wide.txt')
         assert_print_output(self, my_erika,
                             ["abcdefghi", "jklmnopqr", "stuvwxyzä"])
Пример #3
0
 def helper_test_ErikaImageRenderingStrategy_wide(self, strategy):
     """test helper to verify rendering with the given strategy works"""
     with CharacterBasedErikaMock(9, 4, inside_unit_test=True) as my_erika:
         renderer = ErikaImageRenderer(
             my_erika, "test: strategy will be set explicitly")
         renderer.render_file_for_fixed_strategy(
             'tests/test_resources/test_ascii_art_small_wide.txt', strategy)
         assert_print_output(self, my_erika,
                             ["abcdefghi", "jklmnopqr", "stuvwxyzä"])
Пример #4
0
 def helper_test_ErikaImageRenderingStrategy_square(self, strategy):
     """test helper to verify rendering with the given strategy works"""
     with ErikaMock(6, 6) as my_erika:
         renderer = ErikaImageRenderer(my_erika, strategy)
         renderer.render_ascii_art_file(
             'tests/test_resources/test_ascii_art_small.txt')
         assert_print_output(
             self, my_erika,
             ["abcdef", "ghijkl", "mnopqr", "stuvwx", "yzäöüß", "!?#'\"/"])
 def testRenderLineByLineConnect(self):
     """simple test that printing line by line works"""
     with ErikaMock(6, 6) as my_erika:
         rendering_strat = LineByLineErikaImageRenderingStrategy()
         renderer = ErikaImageRenderer(my_erika, rendering_strat)
         renderer.render_ascii_art_file(
             'tests/test_resources/test_ascii_art_small.txt')
         assert_print_output(
             self, my_erika,
             ["abcdef", "ghijkl", "mnopqr", "stuvwx", "yzäöüß", "!?#'\"/"])
Пример #6
0
 def helper_test_ErikaImageRenderingStrategy_high(self, strategy):
     """test helper to verify rendering with the given strategy works"""
     with ErikaMock(3, 12) as my_erika:
         renderer = ErikaImageRenderer(my_erika, strategy)
         renderer.render_ascii_art_file(
             'tests/test_resources/test_ascii_art_small_high.txt')
         assert_print_output(self, my_erika, [
             "abc", "def", "ghi", "jkl", "mno", "pqr", "stu", "vwx", "yzä",
             "öüß", "!?#", "'\"/"
         ])
Пример #7
0
 def test_initial_playing_field(self):
     """Simple test that the initial playing field looks like a tic tac toe grid"""
     with CharacterBasedErikaMock(11, 11, False,
                                  inside_unit_test=True) as my_erika:
         game = TicTacToe(my_erika)
         game._print_initial_field()
         assert_print_output(self, my_erika, [
             "   |   |   ", "-----------", "   |   |   ", "-----------",
             "   |   |   "
         ])
Пример #8
0
 def helper_test_ErikaImageRenderingStrategy_high(self, strategy):
     """test helper to verify rendering with the given strategy works"""
     with CharacterBasedErikaMock(3, 12, inside_unit_test=True) as my_erika:
         renderer = ErikaImageRenderer(
             my_erika, "test: strategy will be set explicitly")
         renderer.render_file_for_fixed_strategy(
             'tests/test_resources/test_ascii_art_small_high.txt', strategy)
         assert_print_output(self, my_erika, [
             "abc", "def", "ghi", "jkl", "mno", "pqr", "stu", "vwx", "yzä",
             "öüß", "!?#", "'\"/"
         ])
Пример #9
0
 def helper_test_ErikaImageRenderingStrategy_square(self, strategy):
     """test helper to verify rendering with the given strategy works"""
     with CharacterBasedErikaMock(
             6, 6, inside_unit_test=True,
             exception_if_overprinted=True) as my_erika:
         renderer = ErikaImageRenderer(
             my_erika, "test: strategy will be set explicitly")
         renderer.render_file_for_fixed_strategy(
             'tests/test_resources/test_ascii_art_small.txt', strategy)
         assert_print_output(
             self, my_erika,
             ["abcdef", "ghijkl", "mnopqr", "stuvwx", "yzäöüß", "!?#'\"/"])