Added more image/C++ tests.

This commit is contained in:
Savio Sena 2014-08-28 18:03:08 -03:00
parent a6d52a1876
commit 2edb6402d6
10 changed files with 234 additions and 7 deletions

View File

@ -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 \

View File

@ -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<evas::image> images;

View File

@ -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<evas::image> 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);

View File

@ -0,0 +1,79 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#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<evas::image> 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();
}

View File

@ -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

View File

@ -0,0 +1,76 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#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<evas::image> 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();
}

View File

@ -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

View File

@ -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" */