summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSavio Sena <savio@expertisesolutions.com.br>2014-10-20 19:43:08 -0200
committerSavio Sena <savio@expertisesolutions.com.br>2014-10-20 19:43:08 -0200
commit309e04e44a2cba1f1bab20ff8b4dc2ba374cac4c (patch)
tree4941f0a531154bf3681e9f62d874a2e844316730
parentef428b5c319cf9bdce789c427fa463c815152c59 (diff)
expedite-cxx: Add missing C++ tests.
-rw-r--r--src/bin/Makefile.am6
-rw-r--r--src/bin/cxx/font_effect_blur_color.cc71
-rw-r--r--src/bin/cxx/font_effect_blur_color_capi.h31
-rw-r--r--src/bin/cxx/poly_blend.cc137
-rw-r--r--src/bin/cxx/poly_blend_capi.h30
-rw-r--r--src/bin/tests.h4
6 files changed, 276 insertions, 3 deletions
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index feb4d93..a00b8ee 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -134,6 +134,8 @@ cxx/image_map_solid_rotate.cc \
134cxx/image_map_solid_rotate_capi.h \ 134cxx/image_map_solid_rotate_capi.h \
135cxx/image_quality_scale.cc \ 135cxx/image_quality_scale.cc \
136cxx/image_quality_scale_capi.h \ 136cxx/image_quality_scale_capi.h \
137cxx/poly_blend.cc \
138cxx/poly_blend_capi.h \
137cxx/line_blend.cc \ 139cxx/line_blend.cc \
138cxx/line_blend_capi.h \ 140cxx/line_blend_capi.h \
139cxx/proxy_image.cc \ 141cxx/proxy_image.cc \
@@ -203,7 +205,9 @@ cxx/widgets_list_4_capi.h \
203cxx/widgets_list_4_grouped.cc \ 205cxx/widgets_list_4_grouped.cc \
204cxx/widgets_list_4_grouped_capi.h \ 206cxx/widgets_list_4_grouped_capi.h \
205cxx/font_effect_blur_alpha.cc \ 207cxx/font_effect_blur_alpha.cc \
206cxx/font_effect_blur_alpha_capi.h 208cxx/font_effect_blur_alpha_capi.h \
209cxx/font_effect_blur_color.cc \
210cxx/font_effect_blur_color_capi.h
207 211
208expedite_SOURCES = \ 212expedite_SOURCES = \
209main.c main.h \ 213main.c main.h \
diff --git a/src/bin/cxx/font_effect_blur_color.cc b/src/bin/cxx/font_effect_blur_color.cc
new file mode 100644
index 0000000..18329d4
--- /dev/null
+++ b/src/bin/cxx/font_effect_blur_color.cc
@@ -0,0 +1,71 @@
1
2#ifdef HAVE_CONFIG_H
3# include <config.h>
4#endif
5
6#include "Eo.h"
7#include "Evas.h"
8
9#include "Eo.hh"
10#include "Eina.hh"
11#include "Evas.hh"
12
13#include "main.h"
14
15#define EXPEDITE_CXX_TEST_IMPL
16#include "font_effect_blur_color_capi.h"
17
18/* standard var */
19static int done = 0;
20extern int win_w, win_h;
21/* private data */
22static evas::text text;
23static const int MAX_BLUR = 100;
24
25/* setup */
26static void _setup(void)
27{
28 evas::canvas canvas(::eo_ref(G_evas));
29 int w, h;
30
31 evas::text o(efl::eo::parent = canvas);
32 o.evas::object::color_set(0, 0, 0, 255);
33 o.font_set("Vera-Bold", 80);
34 o.text_set("Font Effect");
35 o.visibility_set(true);
36 o.evas::object::size_get(&w, &h);
37 o.evas::object::position_set((win_w / 2) - (w / 2) - MAX_BLUR, (win_h / 2) - (h / 2) - MAX_BLUR);
38 text = o;
39 done = 0;
40}
41
42/* cleanup */
43static void _cleanup(void)
44{
45 ::eo_del(text._release());
46}
47
48/* loop - do things */
49static void _loop(double t, int f)
50{
51 if (text)
52 {
53 char buf[256];
54 const char *str = "buffer:a(rgba);padding_set(%d);blend(dst=a,color=darkblue);blur(%d,src=a);";
55 sprintf(buf, str, MAX_BLUR, ((f % MAX_BLUR) + 1));
56 text.filter_program_set(buf);
57 }
58 FPS_STD(NAME);
59}
60
61/* prepend special key handlers if interactive (before STD) */
62static void _key(char *key)
63{
64 KEY_STD;
65}
66
67extern "C" void FNAME(void)
68{
69 ui_func_set(_key, _loop);
70 _setup();
71}
diff --git a/src/bin/cxx/font_effect_blur_color_capi.h b/src/bin/cxx/font_effect_blur_color_capi.h
new file mode 100644
index 0000000..875e240
--- /dev/null
+++ b/src/bin/cxx/font_effect_blur_color_capi.h
@@ -0,0 +1,31 @@
1#ifdef __cplusplus
2extern "C" {
3#endif
4
5#undef FNAME
6#undef NAME
7#undef ICON
8
9/* metadata */
10#define FNAME font_effect_blur_color_cxx_start
11#define NAME "(C++) Font Effect Blur (Color)"
12#define ICON "text.png"
13
14#ifdef UI
15_ui_menu_item_add(ICON, NAME, FNAME);
16#endif
17
18#ifdef PROTO
19void FNAME(void);
20#endif
21
22#ifndef EXPEDITE_CXX_TEST_IMPL
23#undef FNAME
24#undef NAME
25#undef ICON
26#endif
27
28#ifdef __cplusplus
29}
30#endif
31
diff --git a/src/bin/cxx/poly_blend.cc b/src/bin/cxx/poly_blend.cc
new file mode 100644
index 0000000..06823c4
--- /dev/null
+++ b/src/bin/cxx/poly_blend.cc
@@ -0,0 +1,137 @@
1
2#ifdef HAVE_CONFIG_H
3# include <config.h>
4#endif
5
6#include "Eo.h"
7#include "Evas.h"
8
9#include "Eo.hh"
10#include "Eina.hh"
11#include "Evas.hh"
12
13#include "main.h"
14
15#define EXPEDITE_CXX_TEST_IMPL
16#include "poly_blend_capi.h"
17
18/* standard var */
19static int done = 0;
20/* private data */
21static efl::eina::list<evas::polygon> images;
22
23static void
24poly(evas::polygon& o, int type, Evas_Coord x, Evas_Coord y)
25{
26 if (o)
27 {
28 o.points_clear();
29 }
30 switch (type % 4)
31 {
32 case 0: /* triangle */
33 if (o)
34 {
35 o.point_add(x + 50 , y + 0);
36 o.point_add(x + 100, y + 100);
37 o.point_add(x + 0 , y + 100);
38 }
39 break;
40 case 1: /* square */
41 if (o)
42 {
43 o.point_add(x + 0 , y + 0);
44 o.point_add(x + 100, y + 0);
45 o.point_add(x + 100, y + 100);
46 o.point_add(x + 0 , y + 100);
47 }
48 break;
49 case 2: /* hex */
50 if (o)
51 {
52 o.point_add(x + 50 , y + 0);
53 o.point_add(x + 100, y + 30);
54 o.point_add(x + 100, y + 70);
55 o.point_add(x + 50 , y + 100);
56 o.point_add(x + 0 , y + 70);
57 o.point_add(x + 0 , y + 30);
58 }
59 break;
60 case 3: /* star */
61 if (o)
62 {
63 o.point_add(x + 50 , y + 0);
64 o.point_add(x + 60 , y + 40);
65 o.point_add(x + 90 , y + 30);
66 o.point_add(x + 70 , y + 60);
67 o.point_add(x + 90 , y + 100);
68 o.point_add(x + 50 , y + 70);
69 o.point_add(x + 10 , y + 100);
70 o.point_add(x + 30 , y + 60);
71 o.point_add(x + 10 , y + 30);
72 o.point_add(x + 40 , y + 40);
73 }
74 break;
75 default:
76 break;
77 }
78}
79
80/* setup */
81static void _setup(void)
82{
83 evas::canvas canvas(::eo_ref(G_evas));
84 srnd();
85 for (int i = 0; i < OBNUM; i++)
86 {
87 int r, g, b, a;
88 evas::polygon o(efl::eo::parent = canvas);
89 images.push_back(o);
90 a = (rnd()&0xff) / 2;
91 r = ((rnd()&0xff) * a) / 255;
92 g = ((rnd()&0xff) * a) / 255;
93 b = ((rnd()&0xff) * a) / 255;
94 o.evas::object::color_set(r, g, b, a);
95 o.evas::object::visibility_set(true);
96 poly(o, i, 0, 0);
97 }
98 done = 0;
99}
100
101/* cleanup */
102static void _cleanup(void)
103{
104 for (evas::polygon& p : images)
105 p.parent_set(efl::eo::base(nullptr));
106 images.clear();
107}
108
109/* loop - do things */
110static void _loop(double t, int f)
111{
112 int i = 0;
113 Evas_Coord x, y, w, h;
114 for (evas::polygon& o : images)
115 {
116 o.evas::object::size_get(&w, &h);
117 x = (win_w / 2) - (w / 2);
118 x += ::sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (win_w / 4);
119 y = (win_h / 2) - (h / 2);
120 y += ::cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (win_h / 4);
121 o.evas::object::position_set(x, y);
122 ++i;
123 }
124 FPS_STD(NAME);
125}
126
127/* prepend special key handlers if interactive (before STD) */
128static void _key(char *key)
129{
130 KEY_STD;
131}
132
133extern "C" void FNAME(void)
134{
135 ui_func_set(_key, _loop);
136 _setup();
137}
diff --git a/src/bin/cxx/poly_blend_capi.h b/src/bin/cxx/poly_blend_capi.h
new file mode 100644
index 0000000..901dd92
--- /dev/null
+++ b/src/bin/cxx/poly_blend_capi.h
@@ -0,0 +1,30 @@
1#ifdef __cplusplus
2extern "C" {
3#endif
4
5#undef FNAME
6#undef NAME
7#undef ICON
8
9/* metadata */
10#define FNAME poly_blend_cxx_start
11#define NAME "(C++) Polygon Blend"
12#define ICON "rect.png"
13
14#ifdef UI
15_ui_menu_item_add(ICON, NAME, FNAME);
16#endif
17
18#ifdef PROTO
19void FNAME(void);
20#endif
21
22#ifndef EXPEDITE_CXX_TEST_IMPL
23#undef FNAME
24#undef NAME
25#undef ICON
26#endif
27
28#ifdef __cplusplus
29}
30#endif
diff --git a/src/bin/tests.h b/src/bin/tests.h
index 0a54a13..d530f6f 100644
--- a/src/bin/tests.h
+++ b/src/bin/tests.h
@@ -265,7 +265,7 @@ extern "C" {
265#include "cxx/image_blend_occlude3_very_many_capi.h" 265#include "cxx/image_blend_occlude3_very_many_capi.h"
266 266
267#include "poly_blend.c" 267#include "poly_blend.c"
268//#include "cxx/poly_blend_capi.h" 268#include "cxx/poly_blend_capi.h"
269 269
270#include "proxy_image.c" 270#include "proxy_image.c"
271#include "cxx/proxy_image_capi.h" 271#include "cxx/proxy_image_capi.h"
@@ -289,7 +289,7 @@ extern "C" {
289#include "cxx/font_effect_blur_alpha_capi.h" 289#include "cxx/font_effect_blur_alpha_capi.h"
290 290
291#include "font_effect_blur_color.c" 291#include "font_effect_blur_color.c"
292//#include "cxx/font_effect_blur_color.h" 292#include "cxx/font_effect_blur_color_capi.h"
293 293
294#if 0 // test disabled - evas having code disabled 294#if 0 // test disabled - evas having code disabled
295#include "image_mask.c" 295#include "image_mask.c"