summaryrefslogtreecommitdiff
path: root/test/fonts.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/fonts.c')
-rw-r--r--test/fonts.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/fonts.c b/test/fonts.c
index 87a47bb..cd3b9ff 100644
--- a/test/fonts.c
+++ b/test/fonts.c
@@ -54,7 +54,19 @@ int main(int argc, char **argv) {
SDL_Rect clip={30,620,400,30}; SDL_SetRenderClipRect(r,&clip);
assert(sk_text_draw(r,30,617,1.6f,"Clipping preserves the baseline and glyph edges outside this box",strlen("Clipping preserves the baseline and glyph edges outside this box"),112,183,255,255));
SDL_SetRenderClipRect(r,NULL);
+ assert(sk_text_draw(r,30,680,1.6f,"animated ink",12,240,20,40,255));
+ const size_t cached_bytes = c->bytes;
+ assert(sk_text_draw(r,30,730,1.6f,"animated ink",12,40,20,240,128));
+ assert(c->bytes == cached_bytes); /* Color and opacity reuse the coverage mask. */
assert(SDL_RenderPresent(r));
+ unsigned red_pixels = 0, blue_pixels = 0;
+ for (int y=680; y<780; ++y) for (int x=30; x<250; ++x) {
+ Uint8 red, green, blue, alpha;
+ assert(SDL_ReadSurfacePixel(surface,x,y,&red,&green,&blue,&alpha));
+ if (y<710 && red>150 && blue<100) ++red_pixels;
+ if (y>=730 && blue>70 && red<70) ++blue_pixels;
+ }
+ assert(red_pixels>50 && blue_pixels>50);
if(argc>1) assert(SDL_SavePNG(surface,argv[1]));
assert(SDL_SetRenderLogicalPresentation(r,720,410,SDL_LOGICAL_PRESENTATION_LETTERBOX));
assert(fabsf(density(r)-2)<0.01f);