mirror of
https://github.com/pevans/erc-c.git
synced 2024-10-12 11:23:39 +00:00
Get our test suite working with SDL
Had to remove a couple of screen tests for now; it needs a big re-think now that we're using SDL. Namely, how do we test SDL?
This commit is contained in:
parent
05a641c8f6
commit
c84f194c8b
@ -11,14 +11,15 @@ if(CMAKE_C_FLAGS MATCHES "--analyze")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set(opengl_library /System/Library/Frameworks/OpenGL.framework)
|
||||
set(sdl_library /Library/Frameworks/SDL2.framework)
|
||||
set(sdl_headers /Library/Frameworks/SDL2.framework/Headers)
|
||||
endif()
|
||||
|
||||
if(NOT opengl_library)
|
||||
message(FATAL_ERROR "This CMake file is not yet educated as to where OpenGL resides on your platform. Sorry!")
|
||||
if(NOT sdl_library)
|
||||
message(FATAL_ERROR "This CMake file is not yet educated as to where SDL2 resides on your platform. Sorry!")
|
||||
endif()
|
||||
|
||||
include_directories(../include /usr/local/include)
|
||||
include_directories(../include /usr/local/include ${sdl_headers})
|
||||
|
||||
link_directories(/usr/local/lib)
|
||||
|
||||
@ -39,4 +40,4 @@ add_executable(erc-test ${sources} ${test_sources})
|
||||
target_link_libraries(erc-test criterion)
|
||||
|
||||
# Graphics
|
||||
target_link_libraries(erc-test)
|
||||
target_link_libraries(erc-test ${sdl_library})
|
||||
|
@ -4,36 +4,23 @@
|
||||
|
||||
Test(vm_screen, create) {
|
||||
vm_screen *screen;
|
||||
int x = 320;
|
||||
int y = 240;
|
||||
int scale = 2;
|
||||
|
||||
screen = vm_screen_create();
|
||||
screen = vm_screen_create(x, y, scale);
|
||||
cr_assert_neq(screen, NULL);
|
||||
|
||||
cr_assert_eq(screen->color_red, 0);
|
||||
cr_assert_eq(screen->color_blue, 0);
|
||||
cr_assert_eq(screen->color_green, 0);
|
||||
cr_assert_eq(screen->color_alpha, 0);
|
||||
cr_assert_eq(screen->xcoords, x);
|
||||
cr_assert_eq(screen->ycoords, y);
|
||||
cr_assert_eq(screen->scale, scale);
|
||||
|
||||
cr_assert_eq(screen->window, NULL);
|
||||
cr_assert_eq(screen->render, NULL);
|
||||
cr_assert_eq(screen->rect.x, 0);
|
||||
cr_assert_eq(screen->rect.y, 0);
|
||||
cr_assert_eq(screen->rect.w, 0);
|
||||
cr_assert_eq(screen->rect.h, 0);
|
||||
|
||||
vm_screen_free(screen);
|
||||
}
|
||||
|
||||
Test(vm_screen, set_color) {
|
||||
vm_screen *screen;
|
||||
int red = 0xDE;
|
||||
int green = 0xAD;
|
||||
int blue = 0xBE;
|
||||
int alpha = 0xEF;
|
||||
|
||||
screen = vm_screen_create();
|
||||
vm_screen_set_color(screen, red, green, blue, alpha);
|
||||
|
||||
cr_assert_eq(screen->color_red, red);
|
||||
cr_assert_eq(screen->color_green, green);
|
||||
cr_assert_eq(screen->color_blue, blue);
|
||||
cr_assert_eq(screen->color_alpha, alpha);
|
||||
|
||||
vm_screen_free(screen);
|
||||
}
|
||||
|
||||
Test(vm_screen, draw_rect) {
|
||||
// Nothing to do here...
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user