1import os 2import sys 3import time 4import test_utils 5import test_constants 6import logging 7 8generic_16bpp_output_files = [ 9"generic_16bpp_apple.c", 10"generic_16bpp_fish.c", 11"generic_16bpp_foot.c", 12"generic_16bpp_resources.c", 13"generic_16bpp_resources.h", 14"generic_16bpp_specifications.c", 15"generic_16bpp_specifications.h" 16] 17 18#run through all the supported color depths 19def run_color_depths(): 20 21 time.sleep(1) 22 test_utils.configure_project() 23 test_utils.configure_display_color_format('GX_COLOR_FORMAT_565RGB') 24 test_utils.save_project_configure() 25 test_utils.select_project_tree_node('window') 26 test_utils.compare_result() 27 test_utils.move_window(10) 28 test_utils.move_window(-10) 29 30 test_utils.configure_project() 31 test_utils.configure_display_color_format('GX_COLOR_FORMAT_24XRGB') 32 test_utils.save_project_configure() 33 test_utils.select_project_tree_node('window') 34 test_utils.compare_result() 35 test_utils.move_window(10) 36 test_utils.move_window(-10) 37 38 test_utils.configure_project() 39 test_utils.configure_display_color_format('GX_COLOR_FORMAT_32ARGB') 40 test_utils.save_project_configure() 41 test_utils.select_project_tree_node('window') 42 test_utils.compare_result() 43 test_utils.move_window(10) 44 test_utils.move_window(-10) 45 46 test_utils.configure_project() 47 test_utils.configure_display_color_format('GX_COLOR_FORMAT_8BIT_PALETTE') 48 test_utils.set_aa_text_colors(16) 49 test_utils.save_project_configure() 50 test_utils.select_project_tree_node('window') 51 test_utils.compare_result() 52 test_utils.move_window(10) 53 test_utils.move_window(-10) 54 55def run_cut_copy_paste_undo(): 56 time.sleep(1) 57 test_utils.select_project_tree_node('window') 58 test_utils.toolbar_cut() 59 test_utils.select_project_tree_node('default_folder') 60 test_utils.toolbar_paste() 61 62 test_utils.select_project_tree_node('window') 63 test_utils.toolbar_copy() 64 test_utils.select_project_tree_node('default_folder') 65 test_utils.toolbar_paste() 66 test_utils.undo() 67 68 test_utils.select_project_tree_node('pixelmap_button_1') 69 test_utils.move_selected(15) 70 test_utils.toolbar_copy() 71 test_utils.select_project_tree_node('default_folder') 72 test_utils.toolbar_paste() 73 test_utils.undo() 74 75 test_utils.select_project_tree_node('icon_1') 76 test_utils.move_selected(-5) 77 test_utils.toolbar_cut() 78 test_utils.select_project_tree_node('window') 79 test_utils.toolbar_paste() 80 test_utils.undo() 81 #test_utils.undo() 82 83def get_test_header(): 84 85 notes = "* Studio Color Format Tests *\n" 86 notes += "* *\n" 87 notes += "* Verify correct drawing using all image types *\n" 88 notes += "* Verify correct drawing in all output color formats *\n" 89 notes += "* Verify correct drawing using all cpu type settings *\n" 90 return notes 91 92def run_color_format_tests(generate, screenshot): 93 94 test_utils.output_test_header(get_test_header()) 95 test_utils.setup(generate, screenshot, 'test_color_formats_golden_file') 96 97 test_utils.open_project('generic_16bpp.gxp') 98 test_utils.configure_project() 99 test_utils.configure_cpu_type('generic') 100 test_utils.save_project_configure() 101 test_utils.select_project_tree_node('window') 102 test_utils.compare_result() 103 run_cut_copy_paste_undo() 104 run_color_depths() 105 106 test_utils.open_project('generic_16bpp.gxp') 107 test_utils.configure_project() 108 test_utils.configure_cpu_type('synergy') 109 test_utils.save_project_configure() 110 test_utils.select_project_tree_node('window') 111 test_utils.compare_result() 112 run_color_depths() 113 114 test_utils.open_project('generic_32bpp.gxp') 115 test_utils.configure_project() 116 test_utils.configure_cpu_type('generic') 117 test_utils.save_project_configure() 118 test_utils.select_project_tree_node('window') 119 test_utils.compare_result() 120 run_color_depths() 121 122 test_utils.open_project('generic_32bpp.gxp') 123 test_utils.configure_project() 124 test_utils.configure_cpu_type('synergy') 125 test_utils.save_project_configure() 126 test_utils.select_project_tree_node('window') 127 test_utils.compare_result() 128 run_color_depths() 129 130 test_utils.open_project('generic_332rgb.gxp') 131 test_utils.configure_project() 132 test_utils.configure_cpu_type('generic') 133 test_utils.save_project_configure() 134 test_utils.select_project_tree_node('window') 135 test_utils.compare_result() 136 run_color_depths() 137 138 test_utils.open_project('generic_8bpp.gxp') 139 test_utils.configure_project() 140 test_utils.configure_cpu_type('generic') 141 test_utils.save_project_configure() 142 run_color_depths() 143 144 test_utils.open_project('generic_8bpp.gxp') 145 test_utils.configure_project() 146 test_utils.configure_cpu_type('synergy') 147 test_utils.save_project_configure() 148 test_utils.select_project_tree_node('window') 149 test_utils.compare_result() 150 run_color_depths() 151 152 # test file generation when custome file is specified 153 test_utils.generate('generic_16bpp.gxp', test_utils.studio_exe_path) 154 test_utils.cmp_output_files(generic_16bpp_output_files) 155 156 #4bpp driver is special case because message dialog while be shown if color depth is changed. 157 #So test it here. 158 test_utils.open_project('generic_4bpp.gxp') 159 test_utils.configure_project() 160 test_utils.configure_cpu_type('generic') 161 test_utils.save_project_configure() 162 test_utils.select_project_tree_node('window') 163 test_utils.compare_result() 164 test_utils.configure_project() 165 test_utils.configure_display_color_format('GX_COLOR_FORMAT_565RGB') 166 # test_utils.save_project_configure(test_utils.CLOSE_NO_WAIT) 167 # test_utils.close_message_dialog() 168 test_utils.save_project_configure() 169 test_utils.select_project_tree_node('window') 170 test_utils.compare_result() 171 run_color_depths() 172 test_utils.configure_project() 173 test_utils.configure_display_color_format('GX_COLOR_FORMAT_4BIT_GRAY') 174 # test_utils.save_project_configure(test_utils.CLOSE_NO_WAIT) 175 # test_utils.close_message_dialog() 176 test_utils.save_project_configure() 177 test_utils.select_project_tree_node('window') 178 test_utils.compare_result() 179 180 #Same with 4bpp 181 test_utils.open_project('generic_1bpp.gxp') 182 test_utils.configure_project() 183 test_utils.configure_cpu_type('generic') 184 test_utils.save_project_configure() 185 test_utils.select_project_tree_node('window') 186 test_utils.compare_result() 187 test_utils.configure_project() 188 test_utils.configure_display_color_format('GX_COLOR_FORMAT_565RGB') 189 #test_utils.save_project_configure(test_utils.CLOSE_NO_WAIT) 190 #test_utils.close_message_dialog() 191 test_utils.save_project_configure() 192 test_utils.select_project_tree_node('window') 193 test_utils.compare_result() 194 run_color_depths() 195 test_utils.configure_project() 196 test_utils.configure_display_color_format('GX_COLOR_FORMAT_MONOCHROME') 197 #test_utils.save_project_configure(test_utils.CLOSE_NO_WAIT) 198 #test_utils.close_message_dialog() 199 test_utils.save_project_configure() 200 test_utils.select_project_tree_node('window') 201 test_utils.compare_result() 202 203 test_utils.open_project('synergy_16bpp.gxp') 204 test_utils.configure_project() 205 test_utils.configure_cpu_type('synergy') 206 test_utils.save_project_configure() 207 test_utils.select_project_tree_node('window') 208 test_utils.compare_result() 209 run_color_depths() 210 211 test_utils.open_project('synergy_16bpp.gxp') 212 test_utils.configure_project() 213 test_utils.configure_cpu_type('generic') 214 test_utils.save_project_configure() 215 test_utils.select_project_tree_node('window') 216 test_utils.compare_result() 217 run_color_depths() 218 219 test_utils.open_project('synergy_32bpp.gxp') 220 test_utils.configure_project() 221 test_utils.configure_cpu_type('synergy') 222 test_utils.save_project_configure() 223 test_utils.select_project_tree_node('window') 224 test_utils.compare_result() 225 run_color_depths() 226 227 test_utils.open_project('synergy_32bpp.gxp') 228 test_utils.configure_project() 229 test_utils.configure_cpu_type('generic') 230 test_utils.save_project_configure() 231 test_utils.select_project_tree_node('window') 232 test_utils.compare_result() 233 run_color_depths() 234 235 test_utils.write_end("Test Color Formats") 236 237