From ebe7b0745e3ba2fe60cb0f1d1975a321bbce23dc Mon Sep 17 00:00:00 2001 From: Brett Nash Date: Sun, 13 Feb 2011 00:27:08 +0000 Subject: [PATCH] Expedite: Proxy tests: Add some proxy tests. So this covers a basic image, and some text tests. SVN revision: 56976 --- src/bin/Makefile.am | 5 +- src/bin/proxy_image.c | 111 ++++++++++++++++++++++++++++ src/bin/proxy_text_fixed.c | 123 +++++++++++++++++++++++++++++++ src/bin/proxy_text_random.c | 143 ++++++++++++++++++++++++++++++++++++ src/bin/tests.h | 3 + src/bin/ui.c | 3 + 6 files changed, 387 insertions(+), 1 deletion(-) create mode 100644 src/bin/proxy_image.c create mode 100644 src/bin/proxy_text_fixed.c create mode 100644 src/bin/proxy_text_random.c diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 3814735..bad365c 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -109,7 +109,10 @@ image_blend_occlude3_many.c \ image_blend_occlude1_very_many.c \ image_blend_occlude2_very_many.c \ image_blend_occlude3_very_many.c \ -poly_blend.c +poly_blend.c \ +proxy_image.c \ +proxy_text_fixed.c \ +proxy_text_random.c expedite_CFLAGS = @WIN32_CFLAGS@ expedite_CXXFLAGS = @EXPEDITE_CXXFLAGS@ diff --git a/src/bin/proxy_image.c b/src/bin/proxy_image.c new file mode 100644 index 0000000..f1debcd --- /dev/null +++ b/src/bin/proxy_image.c @@ -0,0 +1,111 @@ +#undef FNAME +#undef NAME +#undef ICON + +/* metadata */ +#define FNAME image_blend_unscaled_proxy_start +#define NAME "Image Blend Unscaled Proxy" +#define ICON "blend.png" + +#ifndef PROTO +# ifndef UI +# include "main.h" + +/* standard var */ +static int done = 0; +/* private data */ +static Evas_Object *o_images[OBNUM]; + +/* setup */ +static void _setup(void) +{ + int i; + Evas_Object *o,*src; + + o = evas_object_image_add(evas); + evas_object_image_file_set(o, build_path("logo.png"), NULL); + evas_object_image_fill_set(o, 0, 0, 120, 160); + evas_object_resize(o, 120, 160); + evas_object_show(o); + src = o; + o_images[0] = src; + + for (i = 1; i < OBNUM; i++) + { + o = evas_object_image_add(evas); + o_images[i] = o; + evas_object_image_source_set(o, src); + evas_object_resize(o, 120, 160); + evas_object_image_fill_set(o, 0,0,120,160); + evas_object_show(o); + } + done = 0; +} + +/* cleanup */ +static void _cleanup(void) +{ + int i; + for (i = 0; i < OBNUM; i++) evas_object_del(o_images[i]); +} + +/* loop - do things */ +static void _loop(double t, int f) +{ + int i; + Evas_Coord x, y, w, h; + for (i = 0; i < OBNUM; i++) + { + w = 120; + h = 160; + x = (win_w / 2) - (w / 2); + x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2); + y = (win_h / 2) - (h / 2); + y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2); + evas_object_move(o_images[i], x, y); + } + FPS_STD(NAME); +} + +/* prepend special key handlers if interactive (before STD) */ +static void _key(char *key) +{ + KEY_STD; +} + + + + + + + + + + + + +/* template stuff - ignore */ +# endif +#endif + +#ifdef UI +_ui_menu_item_add(ICON, NAME, FNAME); +#endif + +#ifdef PROTO +void FNAME(void); +#endif + +#ifndef PROTO +# ifndef UI +void FNAME(void) +{ + ui_func_set(_key, _loop); + _setup(); +} +# endif +#endif +#undef FNAME +#undef NAME +#undef ICON + diff --git a/src/bin/proxy_text_fixed.c b/src/bin/proxy_text_fixed.c new file mode 100644 index 0000000..c589a57 --- /dev/null +++ b/src/bin/proxy_text_fixed.c @@ -0,0 +1,123 @@ +#undef FNAME +#undef NAME +#undef ICON + +/* metadata */ +#define FNAME proxy_text_fixed +#define NAME "Proxy Text Fixed" +#define ICON "text.png" + +#ifndef PROTO +# ifndef UI +# include "main.h" + +/* standard var */ +static int done = 0; + +/* private data */ +static Evas_Object *o_texts[OBNUM]; + +/* setup */ +static void _setup(void) +{ + int i,w,h; + Evas_Object *o,*s; + Evas_Text_Style_Type st; + + st = EVAS_TEXT_STYLE_SHADOW; + for (i = 0; st <= EVAS_TEXT_STYLE_FAR_SOFT_SHADOW; i++) + { + o = evas_object_text_add(evas); + o_texts[i] = o; + evas_object_text_font_set(o, "Vera-Bold", 20); + evas_object_text_text_set(o, "This is a test string"); + evas_object_text_style_set(o, st); + evas_object_color_set(o, 255, 255, 255, 255); + evas_object_text_shadow_color_set(o, 0, 0, 0, 24); + evas_object_text_glow_color_set(o, 100, 80, 40, 100); + evas_object_text_glow2_color_set(o, 50, 10, 5, 50); + evas_object_text_outline_color_set(o, 0, 0, 0, 255); + evas_object_show(o); + st++; + } + + for ( ; i < OBNUM ; i ++) + { + s = o_texts[i % st]; + o = evas_object_image_add(evas); + o_texts[i] = o; + evas_object_image_source_set(o, s); + evas_object_geometry_get(s, NULL, NULL, &w, &h); + evas_object_resize(o, w, h); + evas_object_image_fill_set(o, 0, 0, w, h); + evas_object_show(o); + } + + done = 0; +} + +/* cleanup */ +static void _cleanup(void) +{ + int i; + for (i = 0; i < OBNUM; i++) evas_object_del(o_texts[i]); +} + +/* loop - do things */ +static void _loop(double t, int f) +{ + int i; + Evas_Coord x, y, w, h; + for (i = 0; i < OBNUM; i++) + { + evas_object_geometry_get(o_texts[i], NULL, NULL, &w, &h); + x = (win_w / 2) - (w / 2); + x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2); + y = (win_h / 2) - (h / 2); + y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (w / 2); + evas_object_move(o_texts[i], x, y); + } + FPS_STD(NAME); +} + +/* prepend special key handlers if interactive (before STD) */ +static void _key(char *key) +{ + KEY_STD; +} + + + + + + + + + + + + +/* template stuff - ignore */ +# endif +#endif + +#ifdef UI +_ui_menu_item_add(ICON, NAME, FNAME); +#endif + +#ifdef PROTO +void FNAME(void); +#endif + +#ifndef PROTO +# ifndef UI +void FNAME(void) +{ + ui_func_set(_key, _loop); + _setup(); +} +# endif +#endif +#undef FNAME +#undef NAME +#undef ICON diff --git a/src/bin/proxy_text_random.c b/src/bin/proxy_text_random.c new file mode 100644 index 0000000..32fbfba --- /dev/null +++ b/src/bin/proxy_text_random.c @@ -0,0 +1,143 @@ +#undef FNAME +#undef NAME +#undef ICON + +/* metadata */ +#define FNAME proxy_text_random +#define NAME "Proxy Text Random" +#define ICON "text.png" + +#ifndef PROTO +# ifndef UI +# include "main.h" + +/* standard var */ +static int done = 0; + +/* private data */ +static Evas_Object *o_texts[OBNUM]; + +/* setup */ +static void _setup(void) +{ + int i = 0; + Evas_Object *o; + Evas_Coord x, y, w, h; + char buf[1024]; + const char *strs[] = { + "Big", "Smelly", "Fish", "Pants", "Octopus", "Garden", "There", "I", + "Am", "You", "Are", "Erogenous", "We", "Stick", "Wet", "Fishy", + "Fiddly", "Family", "Lair", "Monkeys", "Magazine" + }; + srnd(); + o = evas_object_text_add(evas); + o_texts[0] = o; + evas_object_text_font_set(o, "Vera-Bold", 20); + snprintf(buf, sizeof(buf), "%s %s %s %s.", + strs[rnd() % (sizeof(strs) / sizeof(char *))], + strs[rnd() % (sizeof(strs) / sizeof(char *))], + strs[rnd() % (sizeof(strs) / sizeof(char *))], + strs[rnd() % (sizeof(strs) / sizeof(char *))]); + evas_object_text_text_set(o, buf); + evas_object_color_set(o, 0, 0, 0, 255); + evas_object_geometry_get(o, NULL, NULL, &w, &h); + x = (win_w / 2) - (w / 2); + x += sin((double)((i * 13)) / (36.7 * SLOW)) * (w / 2); + y = (win_h / 2) - (h / 2); + y += cos((double)((i * 28)) / (43.8 * SLOW)) * (w / 2); + evas_object_move(o, x, y); + evas_object_show(o); + for (i = 1 ; i < OBNUM ; i ++) + { + o = evas_object_image_add(evas); + o_texts[i] = o; + evas_object_image_source_set(o, o_texts[0]); + evas_object_geometry_get(o_texts[0], NULL, NULL, &w, &h); + evas_object_resize(o, w, h); + evas_object_image_fill_set(o, 0, 0, w, h); + x = (win_w / 2) - (w / 2); + x += sin((double)((i * 13)) / (36.7 * SLOW)) * (w / 2); + y = (win_h / 2) - (h / 2); + y += cos((double)((i * 28)) / (43.8 * SLOW)) * (w / 2); + evas_object_move(o, x, y); + + evas_object_show(o); + } + + + done = 0; +} + +/* cleanup */ +static void _cleanup(void) +{ + int i; + for (i = 0; i < OBNUM; i++) evas_object_del(o_texts[i]); +} + +/* loop - do things */ +static void _loop(double t, int f) +{ + int i,w,h; + char buf[1024]; + const char *strs[] = { + "Big", "Smelly", "Fish", "Pants", "Octopus", "Garden", "There", "I", + "Am", "You", "Are", "Erogenous", "We", "Stick", "Wet", "Fishy", + "Fiddly", "Family", "Lair", "Monkeys", "Magazine" + }; + snprintf(buf, sizeof(buf), "%s %s %s %s.", + strs[rnd() % (sizeof(strs) / sizeof(char *))], + strs[rnd() % (sizeof(strs) / sizeof(char *))], + strs[rnd() % (sizeof(strs) / sizeof(char *))], + strs[rnd() % (sizeof(strs) / sizeof(char *))]); + evas_object_text_text_set(o_texts[0], buf); + evas_object_geometry_get(o_texts[0], NULL, NULL, &w, &h); + for (i = 1; i < OBNUM; i++) + { + evas_object_resize(o_texts[i],w,h); + evas_object_image_fill_set(o_texts[i],0,0,w,h); + } + FPS_STD(NAME); +} + +/* prepend special key handlers if interactive (before STD) */ +static void _key(char *key) +{ + KEY_STD; +} + + + + + + + + + + + + +/* template stuff - ignore */ +# endif +#endif + +#ifdef UI +_ui_menu_item_add(ICON, NAME, FNAME); +#endif + +#ifdef PROTO +void FNAME(void); +#endif + +#ifndef PROTO +# ifndef UI +void FNAME(void) +{ + ui_func_set(_key, _loop); + _setup(); +} +# endif +#endif +#undef FNAME +#undef NAME +#undef ICON diff --git a/src/bin/tests.h b/src/bin/tests.h index 9182130..202db87 100644 --- a/src/bin/tests.h +++ b/src/bin/tests.h @@ -86,3 +86,6 @@ #include "image_blend_occlude2_very_many.c" #include "image_blend_occlude3_very_many.c" #include "poly_blend.c" +#include "proxy_image.c" +#include "proxy_text_fixed.c" +#include "proxy_text_random.c" diff --git a/src/bin/ui.c b/src/bin/ui.c index b579c50..1fe2cdf 100644 --- a/src/bin/ui.c +++ b/src/bin/ui.c @@ -157,6 +157,9 @@ static double weights[] = 38.2952, // test 86 5.5560, 0.5000, + 10.000, // Proxy tests + 10.000, + 10.000, 0.0, // no final test - add a 0 at the end anyway to pad 0.0,