1 /*
2 Copyright (C) 2009 Facundo Domínguez
3
4 This file is part of Spacejunk.
5
6 Spacejunk is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 Foobar is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Foobar. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "testuta.h"
21 #include "gem-uta.h"
22 #include "assert.h"
23
24 #define UPDW 640
25 #define UPDH 480
26
TestUta()27 void TestUta(){
28 GemUta * uta = gem_uta_new_coords (0, 0, UPDW, UPDH);
29 SDL_Rect r={50,50,100,100};
30 GemRect grect={r.x,r.x + r.w - 1,r.y,r.y + r.h - 1};
31
32 gem_uta_add_rect (uta, &grect);
33 int num_rects;
34 SDL_Rect *rects = gem_uta_get_rects (uta, &num_rects, 0, 0, UPDW, UPDH);
35 assert(num_rects==1 && rects[0].x==r.x && rects[0].y==r.y
36 && rects[0].w==r.w && rects[0].h==r.h);
37 free(rects);
38
39 gem_uta_clear (uta);
40
41 gem_uta_add_rect (uta, &grect);
42 rects = gem_uta_get_rects (uta, &num_rects, 0, 0, UPDW, UPDH);
43 assert(num_rects==1 && rects[0].x==r.x && rects[0].y==r.y
44 && rects[0].w==r.w && rects[0].h==r.h);
45 free(rects);
46
47 gem_uta_free(uta);
48 };
49