1import os 2import sys 3import time 4import test_utils 5import test_constants 6import logging 7 8test_theme_edit_output_files = [ 9"test_theme_edit_resources.c", 10"test_theme_edit_resources.h", 11"test_theme_edit_specifications.c", 12"test_theme_edit_specifications.h"] 13 14def get_test_header(): 15 notes = "* Studio Theme Edit Tests *\n" 16 notes += "* *\n" 17 notes += "* Test edit theme *\n" 18 return notes 19 20def run_theme_edit_tests(generate, screenshot): 21 22 test_utils.output_test_header(get_test_header()) 23 test_utils.setup(generate, screenshot, 'test_theme_edit_golden_file') 24 25 # open test project 26 test_utils.open_project('test_theme_edit.gxp') 27 28 # add theme 2 29 test_utils.configure_themes() 30 test_utils.add_theme() 31 test_utils.set_active_theme("theme_2") 32 test_utils.select_theme_index(2) 33 34 # edit palette for theme 2 and save changes 35 test_utils.edit_palette() 36 37 test_utils.set_palette_color(0, 255, 100, 100) 38 test_utils.save_palette_edit() 39 test_utils.save_theme_configure() 40 41 test_utils.compare_result() 42 43 # add theme 3 44 test_utils.configure_themes() 45 test_utils.add_theme() 46 test_utils.set_active_theme("theme_3") 47 test_utils.select_theme_index(3) 48 49 # edit palette for theme 2, save palette change, cancel theme edit 50 test_utils.edit_palette() 51 52 test_utils.set_palette_color(0, 255, 0, 0) 53 test_utils.save_palette_edit() 54 test_utils.cancel_theme_configure() 55 56 test_utils.compare_result() 57 58 # add theme 3 59 test_utils.configure_themes() 60 test_utils.add_theme() 61 test_utils.set_active_theme("theme_3") 62 test_utils.select_theme_index(3) 63 64 # edit palette for theme 2, cancel palette change, save theme edit 65 test_utils.edit_palette() 66 67 test_utils.set_palette_color(0, 255, 0, 0) 68 test_utils.cancel_palette_edit() 69 test_utils.save_theme_configure() 70 71 test_utils.compare_result() 72 73 test_utils.generate_all() 74 test_utils.click_generate_button() 75 test_utils.cmp_output_files(test_theme_edit_output_files) 76 77 test_utils.write_end("Test Theme Edit") 78 79 80