7874a5f7c6
Add configurable key bindings (TOML), modifier-aware dispatch, mouse-driven pattern placement with preview and rotation, cell grid storage/rendering, and fractional/integer HiDPI scaling. Archive the input-and-placement change and sync its specs to main specs. Tests: Hashtable, Config, Grid, Pattern (4/4 pass).
28 lines
597 B
C
28 lines
597 B
C
#include <assert.h>
|
|
#include <stdio.h>
|
|
|
|
#include "pattern.h"
|
|
|
|
int main(void) {
|
|
assert(pattern_count() == 4);
|
|
const void *p = pattern_get(0);
|
|
(void)p;
|
|
int dx[16], dy[16];
|
|
int n = pattern_rotated_offsets(0, 0, dx, dy);
|
|
assert(n == 5);
|
|
|
|
int w, h;
|
|
pattern_bounds(0, 1, &w, &h);
|
|
assert(w == 3 && h == 3);
|
|
|
|
int dx2[16], dy2[16];
|
|
pattern_rotated_offsets(0, 1, dx2, dy2);
|
|
int same = 1;
|
|
for (int i = 0; i < n; i++) {
|
|
if (dx[i] != dx2[i] || dy[i] != dy2[i]) same = 0;
|
|
}
|
|
assert(!same);
|
|
|
|
printf("pattern tests passed\n");
|
|
return 0;
|
|
} |