Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
SavedGames_test.h
00001 #ifndef SAVEDGAMES_TEST_H 00002 #define SAVEDGAMES_TEST_H 00003 00004 /** Saved Games Test 00005 * @brief Checks saved screen scrolls and draws properly 00006 * @author Benjamin Evans, University of Leeds 00007 * @date May 2020 00008 * @return true if test are passed 00009 */ 00010 bool saved_games_scroll_test(Direction d_, int expected_display_data_number) { 00011 // Objects reqired for test 00012 SavedGames saved; 00013 00014 // Initialise the menu 00015 saved.init(); 00016 00017 printf("Expected display number %d : ",expected_display_data_number); 00018 00019 saved.saved_games_scroll(d_); 00020 00021 int actual_display_data_number = saved.get_display_data_number(); 00022 00023 // Gets the current menu part and checks if it is the expected menu part 00024 if (actual_display_data_number == expected_display_data_number) { 00025 printf ( "Passed!\n"); 00026 return true; 00027 } else { 00028 printf ( "Failed! %d (expecting %d,)\n", actual_display_data_number, 00029 expected_display_data_number); 00030 return false; 00031 } 00032 } 00033 00034 bool display_saved_games_test(int expected_pixel_status, int expected_postion_x, 00035 int expected_postion_y) { 00036 00037 // Objects required for test 00038 SavedGames saved; 00039 N5110 lcd; 00040 00041 // Initialise save and lcd 00042 saved.init(); 00043 lcd.init(); 00044 00045 printf("save_game_screen x,y = %d,%d : ",expected_postion_x, 00046 expected_postion_y ); 00047 00048 saved.display_saved_games(lcd); 00049 00050 // Reads pixel where hud is expected to be drawn 00051 int actual_pixel_status = lcd.getPixel(expected_postion_x, 00052 expected_postion_y); 00053 00054 // Checks if pixel is drawn and therefor testing it hasnt gone of screen 00055 if (actual_pixel_status == expected_pixel_status) { 00056 printf ( "Passed!\n"); 00057 return true; 00058 } else { 00059 printf ( "Failed! value = %d (expecting %d)\n", actual_pixel_status, 00060 expected_pixel_status); 00061 return false; 00062 } 00063 } 00064 00065 bool save_game_screen_test(int expected_pixel_status, int expected_postion_x, 00066 int expected_postion_y) { 00067 00068 // Objects required for test 00069 SavedGames saved; 00070 N5110 lcd; 00071 00072 // Initialise save and lcd 00073 saved.init(); 00074 lcd.init(); 00075 00076 printf("save_game_screen x,y = %d,%d : ",expected_postion_x, 00077 expected_postion_y ); 00078 00079 saved.save_game_screen(lcd); 00080 00081 // Reads pixel where hud is expected to be drawn 00082 int actual_pixel_status = lcd.getPixel(expected_postion_x, 00083 expected_postion_y); 00084 00085 // Checks if pixel is drawn and therefor testing it hasn’t gone of screen 00086 if (actual_pixel_status == expected_pixel_status) { 00087 printf ( "Passed!\n"); 00088 return true; 00089 } else { 00090 printf ( "Failed! value = %d (expecting %d)\n", actual_pixel_status, 00091 expected_pixel_status); 00092 return false; 00093 } 00094 } 00095 00096 00097 #endif
Generated on Fri Aug 5 2022 06:55:07 by
1.7.2