summaryrefslogtreecommitdiffstatsci
path: root/tests
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2020-08-31 03:13:23 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2020-08-31 03:13:23 +0200
commitcf63fa9e34bcca6e4d2252f49d8331ef643f2bec (patch)
tree0eb9a5a8d8fd761cac5fe2642e9aad9fa57c4e18 /tests
parent93dc4d861ed1e4ed15e91307158c11b7db5f1f5f (diff)
debug font cache
Diffstat (limited to 'tests')
-rw-r--r--tests/common/test.c4
-rw-r--r--tests/text.c26
2 files changed, 18 insertions, 12 deletions
diff --git a/tests/common/test.c b/tests/common/test.c
index 733670a..d879fbb 100644
--- a/tests/common/test.c
+++ b/tests/common/test.c
@@ -33,8 +33,8 @@ bool mouseDown = false;
VkvgDevice device = NULL;
VkvgSurface surf = NULL;
-uint32_t test_size = 100; // items drawn in one run, or complexity
-uint32_t iterations = 1000;// repeat test n times
+uint32_t test_size = 500; // items drawn in one run, or complexity
+uint32_t iterations = 500;// repeat test n times
uint32_t test_width = 1024;
uint32_t test_height= 768;
bool test_vsync = false;
diff --git a/tests/text.c b/tests/text.c
index 65165bc..da4ee14 100644
--- a/tests/text.c
+++ b/tests/text.c
@@ -152,23 +152,29 @@ void test(){
vkvg_destroy(ctx);
}
-
-void test_mono () {
+void random_text () {
VkvgContext ctx = vkvg_create(surf);
- vkvg_set_source_rgb(ctx,1,1,1);
+ vkvg_clear(ctx);
vkvg_select_font_face(ctx,"mono");
- vkvg_set_font_size(ctx, 20);
- vkvg_move_to(ctx,100,100);
- vkvg_show_text(ctx,"This is a test string!");
+ for (uint32_t i=0; i<test_size; i++) {
+ randomize_color(ctx);
+ float x = (float)rand()/RAND_MAX * test_width;
+ float y = (float)rand()/RAND_MAX * test_height;
+ uint32_t c = (uint32_t)((float)rand()/RAND_MAX * 80)+1;
+
+ vkvg_set_font_size(ctx, c);
+ vkvg_move_to(ctx,x,y);
+ vkvg_show_text(ctx,"This is a test string!");
+ }
vkvg_destroy(ctx);
}
-
int main(int argc, char *argv[]) {
- PERFORM_TEST (test_mono, argc, argv);
- /*PERFORM_TEST (test, argc, argv);
+ //vkvg_log_level = VKVG_LOG_INFO;
+ PERFORM_TEST (random_text, argc, argv);
+ PERFORM_TEST (test, argc, argv);
PERFORM_TEST (test1, argc, argv);
- PERFORM_TEST (test2, argc, argv);*/
+ PERFORM_TEST (test2, argc, argv);
return 0;
}