expedite-cxx: Add missing C++ tests.

This commit is contained in:
Savio Sena 2014-10-20 19:43:08 -02:00
parent ef428b5c31
commit 309e04e44a
6 changed files with 276 additions and 3 deletions

View File

@ -134,6 +134,8 @@ cxx/image_map_solid_rotate.cc \
cxx/image_map_solid_rotate_capi.h \
cxx/image_quality_scale.cc \
cxx/image_quality_scale_capi.h \
cxx/poly_blend.cc \
cxx/poly_blend_capi.h \
cxx/line_blend.cc \
cxx/line_blend_capi.h \
cxx/proxy_image.cc \
@ -203,7 +205,9 @@ cxx/widgets_list_4_capi.h \
cxx/widgets_list_4_grouped.cc \
cxx/widgets_list_4_grouped_capi.h \
cxx/font_effect_blur_alpha.cc \
cxx/font_effect_blur_alpha_capi.h
cxx/font_effect_blur_alpha_capi.h \
cxx/font_effect_blur_color.cc \
cxx/font_effect_blur_color_capi.h
expedite_SOURCES = \
main.c main.h \

View File

@ -0,0 +1,71 @@
#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 "font_effect_blur_color_capi.h"
/* standard var */
static int done = 0;
extern int win_w, win_h;
/* private data */
static evas::text text;
static const int MAX_BLUR = 100;
/* setup */
static void _setup(void)
{
evas::canvas canvas(::eo_ref(G_evas));
int w, h;
evas::text o(efl::eo::parent = canvas);
o.evas::object::color_set(0, 0, 0, 255);
o.font_set("Vera-Bold", 80);
o.text_set("Font Effect");
o.visibility_set(true);
o.evas::object::size_get(&w, &h);
o.evas::object::position_set((win_w / 2) - (w / 2) - MAX_BLUR, (win_h / 2) - (h / 2) - MAX_BLUR);
text = o;
done = 0;
}
/* cleanup */
static void _cleanup(void)
{
::eo_del(text._release());
}
/* loop - do things */
static void _loop(double t, int f)
{
if (text)
{
char buf[256];
const char *str = "buffer:a(rgba);padding_set(%d);blend(dst=a,color=darkblue);blur(%d,src=a);";
sprintf(buf, str, MAX_BLUR, ((f % MAX_BLUR) + 1));
text.filter_program_set(buf);
}
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,31 @@
#ifdef __cplusplus
extern "C" {
#endif
#undef FNAME
#undef NAME
#undef ICON
/* metadata */
#define FNAME font_effect_blur_color_cxx_start
#define NAME "(C++) Font Effect Blur (Color)"
#define ICON "text.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

137
src/bin/cxx/poly_blend.cc Normal file
View File

@ -0,0 +1,137 @@
#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 "poly_blend_capi.h"
/* standard var */
static int done = 0;
/* private data */
static efl::eina::list<evas::polygon> images;
static void
poly(evas::polygon& o, int type, Evas_Coord x, Evas_Coord y)
{
if (o)
{
o.points_clear();
}
switch (type % 4)
{
case 0: /* triangle */
if (o)
{
o.point_add(x + 50 , y + 0);
o.point_add(x + 100, y + 100);
o.point_add(x + 0 , y + 100);
}
break;
case 1: /* square */
if (o)
{
o.point_add(x + 0 , y + 0);
o.point_add(x + 100, y + 0);
o.point_add(x + 100, y + 100);
o.point_add(x + 0 , y + 100);
}
break;
case 2: /* hex */
if (o)
{
o.point_add(x + 50 , y + 0);
o.point_add(x + 100, y + 30);
o.point_add(x + 100, y + 70);
o.point_add(x + 50 , y + 100);
o.point_add(x + 0 , y + 70);
o.point_add(x + 0 , y + 30);
}
break;
case 3: /* star */
if (o)
{
o.point_add(x + 50 , y + 0);
o.point_add(x + 60 , y + 40);
o.point_add(x + 90 , y + 30);
o.point_add(x + 70 , y + 60);
o.point_add(x + 90 , y + 100);
o.point_add(x + 50 , y + 70);
o.point_add(x + 10 , y + 100);
o.point_add(x + 30 , y + 60);
o.point_add(x + 10 , y + 30);
o.point_add(x + 40 , y + 40);
}
break;
default:
break;
}
}
/* setup */
static void _setup(void)
{
evas::canvas canvas(::eo_ref(G_evas));
srnd();
for (int i = 0; i < OBNUM; i++)
{
int r, g, b, a;
evas::polygon o(efl::eo::parent = canvas);
images.push_back(o);
a = (rnd()&0xff) / 2;
r = ((rnd()&0xff) * a) / 255;
g = ((rnd()&0xff) * a) / 255;
b = ((rnd()&0xff) * a) / 255;
o.evas::object::color_set(r, g, b, a);
o.evas::object::visibility_set(true);
poly(o, i, 0, 0);
}
done = 0;
}
/* cleanup */
static void _cleanup(void)
{
for (evas::polygon& p : images)
p.parent_set(efl::eo::base(nullptr));
images.clear();
}
/* loop - do things */
static void _loop(double t, int f)
{
int i = 0;
Evas_Coord x, y, w, h;
for (evas::polygon& o : images)
{
o.evas::object::size_get(&w, &h);
x = (win_w / 2) - (w / 2);
x += ::sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (win_w / 4);
y = (win_h / 2) - (h / 2);
y += ::cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (win_h / 4);
o.evas::object::position_set(x, y);
++i;
}
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,30 @@
#ifdef __cplusplus
extern "C" {
#endif
#undef FNAME
#undef NAME
#undef ICON
/* metadata */
#define FNAME poly_blend_cxx_start
#define NAME "(C++) Polygon Blend"
#define ICON "rect.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

@ -265,7 +265,7 @@ extern "C" {
#include "cxx/image_blend_occlude3_very_many_capi.h"
#include "poly_blend.c"
//#include "cxx/poly_blend_capi.h"
#include "cxx/poly_blend_capi.h"
#include "proxy_image.c"
#include "cxx/proxy_image_capi.h"
@ -289,7 +289,7 @@ extern "C" {
#include "cxx/font_effect_blur_alpha_capi.h"
#include "font_effect_blur_color.c"
//#include "cxx/font_effect_blur_color.h"
#include "cxx/font_effect_blur_color_capi.h"
#if 0 // test disabled - evas having code disabled
#include "image_mask.c"