2011-02-06 23:31:55 -02:00
|
|
|
#include <assert.h>
|
2011-05-07 23:09:39 -03:00
|
|
|
#include "test_helper.h"
|
2011-05-31 03:03:13 -03:00
|
|
|
#include "../src/frame.h"
|
2011-02-06 23:31:55 -02:00
|
|
|
|
|
|
|
void test_initialize_frame() {
|
|
|
|
struct frame *frame;
|
|
|
|
|
|
|
|
allocate_frame(&frame);
|
|
|
|
initialize_frame(frame);
|
2011-02-12 16:00:23 -02:00
|
|
|
|
2011-05-09 00:50:56 -03:00
|
|
|
assert(frame->window == NULL);
|
2011-05-09 00:38:31 -03:00
|
|
|
assert(frame->begin_y == 0);
|
|
|
|
assert(frame->begin_x == 0);
|
2011-02-06 23:31:55 -02:00
|
|
|
|
2011-02-14 00:10:47 -02:00
|
|
|
free_frame(frame);
|
2011-02-06 23:31:55 -02:00
|
|
|
}
|
|
|
|
|
2011-05-01 03:06:43 -03:00
|
|
|
void test_duplicate_frame() {
|
|
|
|
struct frame *frame_0, *frame_1;
|
2011-05-09 00:38:31 -03:00
|
|
|
const int begin_y = 5, begin_x = 10;
|
2011-05-01 03:06:43 -03:00
|
|
|
|
|
|
|
allocate_frame(&frame_0);
|
2011-05-09 00:38:31 -03:00
|
|
|
set_frame(frame_0, begin_y, begin_x);
|
2011-05-01 03:06:43 -03:00
|
|
|
frame_1 = duplicate_frame(frame_0);
|
|
|
|
|
|
|
|
assert(frame_0 != frame_1);
|
|
|
|
assert(frames_equal(frame_0, frame_1));
|
|
|
|
}
|
|
|
|
|
2011-02-06 23:31:55 -02:00
|
|
|
void test_set_frame() {
|
|
|
|
struct frame *frame;
|
2011-05-09 00:38:31 -03:00
|
|
|
int begin_y = 5;
|
|
|
|
int begin_x = 10;
|
2011-02-06 23:31:55 -02:00
|
|
|
|
|
|
|
allocate_frame(&frame);
|
|
|
|
initialize_frame(frame);
|
2011-05-09 00:38:31 -03:00
|
|
|
set_frame(frame, begin_y, begin_x);
|
2011-02-06 23:31:55 -02:00
|
|
|
|
2011-05-09 00:38:31 -03:00
|
|
|
assert(frame->begin_y == begin_y);
|
|
|
|
assert(frame->begin_x == begin_x);
|
2011-02-06 23:31:55 -02:00
|
|
|
|
2011-02-14 00:10:47 -02:00
|
|
|
free_frame(frame);
|
2011-02-06 23:31:55 -02:00
|
|
|
}
|
|
|
|
|
|
|
|
void test_frame() {
|
|
|
|
test_initialize_frame();
|
2011-05-01 03:06:43 -03:00
|
|
|
test_duplicate_frame();
|
2011-02-06 23:31:55 -02:00
|
|
|
test_set_frame();
|
|
|
|
}
|