summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-13 15:07:42 -0300
committerGabriel Schneider <[email protected]>2026-11-13 15:07:42 -0300
commitd3074636fff0fbcd5fd9b71c0c3b1c1f5c0c1285 (patch)
tree918d67acc8f00f72cc4ae1ba444e41238a689c2b /test
parent409c1accefeb7a775c0914c888b469a1e78fc69a (diff)
downloadsketchbook-main.tar.gz
sketchbook-main.zip
host: add optional Tracy profiling and reduce upload allocation stallsHEADmain
Diffstat (limited to 'test')
-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);