Skip to content

Commit

Permalink
Add more RGBGFX test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Rangi42 committed Oct 26, 2024
1 parent 5efd303 commit aa03bd6
Show file tree
Hide file tree
Showing 55 changed files with 67 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/gfx/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void Options::verbosePrint(uint8_t level, char const *fmt, ...) const {
}

// Short options
static char const *optstring = "-Aa:b:Cc:Dd:Ffhi:L:mN:n:Oo:Pp:Qq:r:s:Tt:U:uVvx:Z";
static char const *optstring = "-Aa:b:Cc:d:i:L:mN:n:Oo:Pp:Qq:r:s:Tt:U:uVvXx:YZ";

/*
* Equivalent long options
Expand Down Expand Up @@ -139,6 +139,7 @@ static option const longopts[] = {
{"auto-palette-map", no_argument, nullptr, 'Q'},
{"palette-map", required_argument, nullptr, 'q'},
{"reverse", required_argument, nullptr, 'r'},
{"palette-size", required_argument, nullptr, 's'},
{"auto-tilemap", no_argument, nullptr, 'T'},
{"tilemap", required_argument, nullptr, 't'},
{"unit-size", required_argument, nullptr, 'U'},
Expand Down
1 change: 1 addition & 0 deletions test/gfx/color_curve.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-C
Binary file added test/gfx/color_curve.out.2bpp
Binary file not shown.
Binary file added test/gfx/color_curve.out.pal
Binary file not shown.
Binary file added test/gfx/color_curve.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions test/gfx/empty_lines.hex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

5721d9

a9d4fe
A9D4FE


ffffff
ffFFfF
Binary file added test/gfx/full_aco.aco
Binary file not shown.
1 change: 1 addition & 0 deletions test/gfx/full_aco.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-c aco:full_aco.aco
Binary file added test/gfx/full_aco.out.2bpp
Binary file not shown.
Binary file added test/gfx/full_aco.out.attrmap
Binary file not shown.
Binary file added test/gfx/full_aco.out.pal
Binary file not shown.
Binary file added test/gfx/full_aco.out.tilemap
Binary file not shown.
Binary file added test/gfx/full_aco.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added test/gfx/full_act.act
Binary file not shown.
1 change: 1 addition & 0 deletions test/gfx/full_act.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-c act:full_act.act
Binary file added test/gfx/full_act.out.2bpp
Binary file not shown.
Binary file added test/gfx/full_act.out.attrmap
Binary file not shown.
Binary file added test/gfx/full_act.out.pal
Binary file not shown.
Binary file added test/gfx/full_act.out.tilemap
Binary file not shown.
Binary file added test/gfx/full_act.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions test/gfx/full_gbc.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-c gbc:full_gbc.pal
Binary file added test/gfx/full_gbc.out.2bpp
Binary file not shown.
Binary file added test/gfx/full_gbc.out.attrmap
Binary file not shown.
Binary file added test/gfx/full_gbc.out.pal
Binary file not shown.
Binary file added test/gfx/full_gbc.out.tilemap
Binary file not shown.
Binary file added test/gfx/full_gbc.pal
Binary file not shown.
Binary file added test/gfx/full_gbc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions test/gfx/full_psp.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-c psp:full_psp.pal
Binary file added test/gfx/full_psp.out.2bpp
Binary file not shown.
Binary file added test/gfx/full_psp.out.attrmap
Binary file not shown.
Binary file added test/gfx/full_psp.out.pal
Binary file not shown.
Binary file added test/gfx/full_psp.out.tilemap
Binary file not shown.
35 changes: 35 additions & 0 deletions test/gfx/full_psp.pal
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
JASC-PAL
0100
32
0 0 0
252 252 252
196 199 238
154 143 224
99 93 150
41 47 101
27 29 52
255 227 174
205 187 171
166 133 143
207 93 139
150 73 104
255 180 130
221 134 125
178 105 111
246 198 94
228 144 87
196 104 51
176 208 126
102 170 93
82 181 171
42 131 121
28 86 89
123 225 246
88 159 252
80 105 228
46 68 174
128 86 212
90 59 150
255 186 225
230 135 197
167 89 185
Binary file added test/gfx/full_psp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions test/gfx/mirror_x.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-X
1 change: 1 addition & 0 deletions test/gfx/mirror_x.out.2bpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
￿￿￿￿￿￿膁膁膁￿￿膁膁膁￿￿￿￿￿膁膁膁￿￿膁膁膁辏辏辏￿￿辏辏辏￿￿膁膁膁膁膁膁￿￿￿￿￿￿￿￿￿
Binary file added test/gfx/mirror_x.out.attrmap
Binary file not shown.
Binary file added test/gfx/mirror_x.out.tilemap
Binary file not shown.
Binary file added test/gfx/mirror_x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions test/gfx/mirror_xy.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-XY
1 change: 1 addition & 0 deletions test/gfx/mirror_xy.out.2bpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
￿￿￿￿￿￿膁膁膁￿￿膁膁膁￿￿辏辏辏￿￿膁膁膁膁膁膁￿￿￿￿￿￿￿￿￿
Binary file added test/gfx/mirror_xy.out.attrmap
Binary file not shown.
Binary file added test/gfx/mirror_xy.out.tilemap
Binary file not shown.
Binary file added test/gfx/mirror_xy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions test/gfx/mirror_y.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Y
1 change: 1 addition & 0 deletions test/gfx/mirror_y.out.2bpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
￿￿￿辏辏辏辏辏辏￿￿￿￿￿膁膁膁￿￿膁膁膁￿￿辏辏辏膁膁膁￿￿辏辏辏￿￿膁膁膁膁膁膁￿￿￿￿￿￿￿￿￿
Binary file added test/gfx/mirror_y.out.attrmap
Binary file not shown.
Binary file added test/gfx/mirror_y.out.tilemap
Binary file not shown.
Binary file added test/gfx/mirror_y.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions test/gfx/reverse_curve.2bpp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
܇Ἐ㼠罀罌タタタノ繇籃㰣ḙ܇
Binary file added test/gfx/reverse_curve.attrmap
Binary file not shown.
4 changes: 4 additions & 0 deletions test/gfx/reverse_curve.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-m
-t reverse_curve.tilemap
-a reverse_curve.attrmap
-p reverse_curve.pal
Binary file added test/gfx/reverse_curve.pal
Binary file not shown.
Binary file added test/gfx/reverse_curve.tilemap
Binary file not shown.
15 changes: 12 additions & 3 deletions test/gfx/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,20 @@ failTest () {
echo "${bold}${red}Test ${cmdline} failed!${1:+ (RC=$1)}${rescolors}${resbold}"
}

tryCmp () {
if ! cmp "$1" "$2"; then
../../contrib/gbdiff.bash "$1" "$2"
echo "${bold}${red}$1 mismatch!${rescolors}${resbold}"
false
fi
(( our_rc = our_rc || $? ))
}

checkOutput () {
out_rc=0
for ext in 1bpp 2bpp pal tilemap attrmap palmap; do
if [[ -e "$1.out.$ext" ]]; then
cmp "$1.out.$ext" "result.$ext"
tryCmp "$1.out.$ext" "result.$ext"
(( out_rc = out_rc || $? ))
fi
done
Expand Down Expand Up @@ -95,10 +104,10 @@ for f in *.[12]bpp; do
continue
fi

flags="$([[ -e "${f%.[12]bpp}.flags" ]] && echo "@${f%.[12]bpp}.flags")"
flags="$([[ -e "${f%.[12]bpp}.flags" ]] && echo "@${f%.[12]bpp}.flags") $([[ -e "${f%.1bpp}.flags" ]] && echo "-d 1")"

newTest "$RGBGFX $flags -o $f -r 1 result.png && $RGBGFX $flags -o result.2bpp result.png"
runTest && cmp "$f" result.2bpp || failTest $?
runTest && tryCmp "$f" result.2bpp || failTest $?
done

if [[ "$failed" -eq 0 ]]; then
Expand Down

0 comments on commit aa03bd6

Please sign in to comment.