From 2edb6402d654e4fd5f87e1d8ccecae30476e41a2 Mon Sep 17 00:00:00 2001 From: Savio Sena Date: Thu, 28 Aug 2014 18:03:08 -0300 Subject: [PATCH] Added more image/C++ tests. --- src/bin/Makefile.am | 8 +- src/bin/cxx/image_blend_border.cc | 2 +- ...border_cxx.c => image_blend_border_capi.h} | 0 src/bin/cxx/image_blend_border_recolor.cc | 4 +- ...xx.c => image_blend_border_recolor_capi.h} | 0 src/bin/cxx/image_blend_fade_pow2_unscaled.cc | 79 +++++++++++++++++++ .../cxx/image_blend_fade_pow2_unscaled_capi.h | 33 ++++++++ src/bin/cxx/image_blend_fade_unscaled.cc | 76 ++++++++++++++++++ src/bin/cxx/image_blend_fade_unscaled_capi.h | 33 ++++++++ src/bin/tests.h | 6 +- 10 files changed, 234 insertions(+), 7 deletions(-) rename src/bin/cxx/{image_blend_border_cxx.c => image_blend_border_capi.h} (100%) rename src/bin/cxx/{image_blend_border_recolor_cxx.c => image_blend_border_recolor_capi.h} (100%) create mode 100644 src/bin/cxx/image_blend_fade_pow2_unscaled.cc create mode 100644 src/bin/cxx/image_blend_fade_pow2_unscaled_capi.h create mode 100644 src/bin/cxx/image_blend_fade_unscaled.cc create mode 100644 src/bin/cxx/image_blend_fade_unscaled_capi.h diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 135d261..1ce1509 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -36,7 +36,11 @@ widgets_list_4_grouped.c \ image_blend_unscaled.c \ image_blend_solid_middle_unscaled.c \ image_blend_fade_unscaled.c \ +cxx/image_blend_fade_unscaled.cc \ +cxx/image_blend_fade_unscaled_capi.h \ image_blend_fade_pow2_unscaled.c \ +cxx/image_blend_fade_pow2_unscaled.cc \ +ocxx/image_blend_fade_pow2_unscaled_capi.h \ image_blend_solid_unscaled.c \ image_blend_solid_fade_unscaled.c \ image_blend_solid_fade_pow2_unscaled.c \ @@ -50,10 +54,10 @@ image_blend_smooth_same_scaled.c \ image_blend_smooth_solid_same_scaled.c \ image_blend_border.c \ cxx/image_blend_border.cc \ -cxx/image_blend_border_cxx.c \ +cxx/image_blend_border_capi.h \ image_blend_border_recolor.c \ cxx/image_blend_border_recolor.cc \ -cxx/image_blend_border_recolor_cxx.c \ +cxx/image_blend_border_recolor_capi.h \ image_blend_solid_middle_border.c \ image_blend_solid_border.c \ image_map_rotate.c \ diff --git a/src/bin/cxx/image_blend_border.cc b/src/bin/cxx/image_blend_border.cc index 18d5dea..4fdfeee 100644 --- a/src/bin/cxx/image_blend_border.cc +++ b/src/bin/cxx/image_blend_border.cc @@ -13,7 +13,7 @@ #include "main.h" #define EXPEDITE_CXX_TEST_IMPL -#include "image_blend_border_cxx.c" +#include "image_blend_border_capi.h" static efl::eina::list images; diff --git a/src/bin/cxx/image_blend_border_cxx.c b/src/bin/cxx/image_blend_border_capi.h similarity index 100% rename from src/bin/cxx/image_blend_border_cxx.c rename to src/bin/cxx/image_blend_border_capi.h diff --git a/src/bin/cxx/image_blend_border_recolor.cc b/src/bin/cxx/image_blend_border_recolor.cc index 4841b65..049fa95 100644 --- a/src/bin/cxx/image_blend_border_recolor.cc +++ b/src/bin/cxx/image_blend_border_recolor.cc @@ -13,7 +13,7 @@ #include "main.h" #define EXPEDITE_CXX_TEST_IMPL -#include "image_blend_border_recolor_cxx.c" +#include "image_blend_border_recolor_capi.h" efl::eina::list images; @@ -28,7 +28,7 @@ static void _setup(void) { evas::image o(efl::eo::parent = canvas); images.push_back(o); - o.file_set(::build_path("bar.png"), ""); + o.file_set(::build_path("pan.png"), ""); o.color_set(64, 64, 64, 255); o.border_set(3, 3, 3, 3); o.visibility_set(true); diff --git a/src/bin/cxx/image_blend_border_recolor_cxx.c b/src/bin/cxx/image_blend_border_recolor_capi.h similarity index 100% rename from src/bin/cxx/image_blend_border_recolor_cxx.c rename to src/bin/cxx/image_blend_border_recolor_capi.h diff --git a/src/bin/cxx/image_blend_fade_pow2_unscaled.cc b/src/bin/cxx/image_blend_fade_pow2_unscaled.cc new file mode 100644 index 0000000..d194b41 --- /dev/null +++ b/src/bin/cxx/image_blend_fade_pow2_unscaled.cc @@ -0,0 +1,79 @@ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "Eo.h" +#include "Evas.h" + +#include "Eo.hh" +#include "Eina.hh" +#include "Evas.hh" + +#include "main.h" + +#define EXPEDITE_CXX_TEST_IMPL +#include "image_blend_fade_pow2_unscaled_capi.h" + +static efl::eina::list images; + +/* standard var */ +static int done = 0; + +/* setup */ +static void _setup(void) +{ + evas::canvas canvas(::eo_ref(G_evas)); + for (int i = 0; i < OBNUM; i++) + { + evas::image o(efl::eo::parent = canvas); + images.push_back(o); + + o.file_set(::build_path("logo.png"), ""); + o.fill_set(0, 0, 120, 160); + o.evas::object::size_set(120, 160); + + int a = 256 - (1 << ((rnd() % 8) + 1)); + if (a < 128) a = 128; + + o.color_set(a, a, a, a); + o.visibility_set(true); + } + done = 0; +} + +/* cleanup */ +static void _cleanup(void) +{ + images.clear(); +} + +/* loop - do things */ +static void _loop(double t, int f) +{ + int i = 0; + Evas_Coord x, y, w, h; + for (auto it = images.begin(), end = images.end(); it != end; it++, 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); + (*it).position_set(x, y); + } + FPS_STD(NAME); +} + +/* prepend special key handlers if interactive (before STD) */ +static void _key(char *key) +{ + KEY_STD; +} + +extern "C" void FNAME(void) +{ + ui_func_set(_key, _loop); + _setup(); +} diff --git a/src/bin/cxx/image_blend_fade_pow2_unscaled_capi.h b/src/bin/cxx/image_blend_fade_pow2_unscaled_capi.h new file mode 100644 index 0000000..38b8657 --- /dev/null +++ b/src/bin/cxx/image_blend_fade_pow2_unscaled_capi.h @@ -0,0 +1,33 @@ + +#ifdef __cplusplus +extern "C" { +#endif + +#undef FNAME +#undef NAME +#undef ICON + +/* metadata */ +#define FNAME image_blend_fade_pow2_unscaled_cxx_start +#define NAME "Image Blend Fade Power 2 Unscaled (C++)" +#define ICON "blend.png" + +#ifdef UI +_ui_menu_item_add(ICON, NAME, FNAME); +#endif + +#ifdef PROTO +void FNAME(void); +#endif + +#ifndef EXPEDITE_CXX_TEST_IMPL +#undef FNAME +#undef NAME +#undef ICON +#endif + +#ifdef __cplusplus +} +#endif + + diff --git a/src/bin/cxx/image_blend_fade_unscaled.cc b/src/bin/cxx/image_blend_fade_unscaled.cc new file mode 100644 index 0000000..93564b8 --- /dev/null +++ b/src/bin/cxx/image_blend_fade_unscaled.cc @@ -0,0 +1,76 @@ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "Eo.h" +#include "Evas.h" + +#include "Eo.hh" +#include "Eina.hh" +#include "Evas.hh" + +#include "main.h" + +#define EXPEDITE_CXX_TEST_IMPL +#include "image_blend_fade_unscaled_capi.h" + +/* standard var */ +static int done = 0; +/* private data */ +static efl::eina::list images; + +/* setup */ +static void _setup(void) +{ + evas::canvas canvas(::eo_ref(G_evas)); + for (int i = 0; i < OBNUM; i++) + { + evas::image o(efl::eo::parent = canvas); + images.push_back(o); + o.file_set(::build_path("logo.png"), ""); + o.fill_set(0, 0, 120, 160); + o.evas::object::size_set(120, 160); + + int a = rnd()&0xff; + o.color_set(a, a, a, a); + o.visibility_set(true); + } + done = 0; +} + +/* cleanup */ +static void _cleanup(void) +{ + images.clear(); +} + +/* loop - do things */ +static void _loop(double t, int f) +{ + int i = 0; + Evas_Coord x, y, w, h; + for (auto it = images.begin(), end = images.end(); it != end; it++, 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); + (*it).position_set(x, y); + } + FPS_STD(NAME); +} + +/* prepend special key handlers if interactive (before STD) */ +static void _key(char *key) +{ + KEY_STD; +} + +extern "C" void FNAME(void) +{ + ui_func_set(_key, _loop); + _setup(); +} diff --git a/src/bin/cxx/image_blend_fade_unscaled_capi.h b/src/bin/cxx/image_blend_fade_unscaled_capi.h new file mode 100644 index 0000000..3afcb1a --- /dev/null +++ b/src/bin/cxx/image_blend_fade_unscaled_capi.h @@ -0,0 +1,33 @@ + +#ifdef __cplusplus +extern "C" { +#endif + +#undef FNAME +#undef NAME +#undef ICON + +/* metadata */ +#define FNAME image_blend_fade_unscaled_cxx_start +#define NAME "Image Blend Fade Unscaled (C++)" +#define ICON "blend.png" + +#ifdef UI +_ui_menu_item_add(ICON, NAME, FNAME); +#endif + +#ifdef PROTO +void FNAME(void); +#endif + +#ifndef EXPEDITE_CXX_TEST_IMPL +#undef FNAME +#undef NAME +#undef ICON +#endif + +#ifdef __cplusplus +} +#endif + + diff --git a/src/bin/tests.h b/src/bin/tests.h index 338c0f2..936bf46 100644 --- a/src/bin/tests.h +++ b/src/bin/tests.h @@ -4,8 +4,10 @@ extern "C" { #endif // C++ tests -#include "cxx/image_blend_border_cxx.c" -#include "cxx/image_blend_border_recolor_cxx.c" +#include "cxx/image_blend_fade_unscaled_capi.h" +#include "cxx/image_blend_fade_pow2_unscaled_capi.h" +#include "cxx/image_blend_border_capi.h" +#include "cxx/image_blend_border_recolor_capi.h" // C tests /* #include "widgets_file_icons.c" */