summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSavio Sena <savio@expertisesolutions.com.br>2014-08-28 19:32:39 -0300
committerSavio Sena <savio@expertisesolutions.com.br>2014-08-28 19:32:39 -0300
commit1efc8c8a30c457cef02bf015c4b3ab7d73a3fbde (patch)
tree7879d05a90efdbc5bb208e78cefa95b759b3f499
parentc895eba3fde2750c929d5f36f48f5bf676f1a838 (diff)
Added more image/C++ tests.
-rw-r--r--src/bin/cxx/image_blend_solid_border.cc91
-rw-r--r--src/bin/cxx/image_blend_solid_fade_pow2_unscaled.cc94
-rw-r--r--src/bin/cxx/image_blend_solid_fade_unscaled.cc96
-rw-r--r--src/bin/cxx/image_blend_solid_unscaled.cc74
-rw-r--r--src/bin/cxx/image_blend_solid_unscaled_capi.h32
-rw-r--r--src/bin/tests.h5
6 files changed, 204 insertions, 188 deletions
diff --git a/src/bin/cxx/image_blend_solid_border.cc b/src/bin/cxx/image_blend_solid_border.cc
index 6b1f77e..99f5239 100644
--- a/src/bin/cxx/image_blend_solid_border.cc
+++ b/src/bin/cxx/image_blend_solid_border.cc
@@ -1,34 +1,36 @@
1#undef FNAME
2#undef NAME
3#undef ICON
4 1
5/* metadata */ 2#ifdef HAVE_CONFIG_H
6#define FNAME image_blend_solid_border_start 3# include <config.h>
7#define NAME "Image Blend Solid Border" 4#endif
8#define ICON "blend.png" 5
6#include "Eo.h"
7#include "Evas.h"
8
9#include "Eo.hh"
10#include "Eina.hh"
11#include "Evas.hh"
9 12
10#ifndef PROTO 13#include "main.h"
11# ifndef UI 14
12# include "main.h" 15#define EXPEDITE_CXX_TEST_IMPL
16#include "image_blend_solid_border_capi.h"
17
18static efl::eina::list<evas::image> images;
13 19
14/* standard var */ 20/* standard var */
15static int done = 0; 21static int done = 0;
16/* private data */
17static Evas_Object *o_images[OBNUM];
18 22
19/* setup */ 23/* setup */
20static void _setup(void) 24static void _setup(void)
21{ 25{
22 int i; 26 evas::canvas canvas(::eo_ref(G_evas));
23 Evas_Object *o; 27 for (int i = 0; i < OBNUM; i++)
24 for (i = 0; i < OBNUM; i++)
25 { 28 {
26 o = eo_add(EVAS_IMAGE_CLASS, G_evas); 29 evas::image o(efl::eo::parent = canvas);
27 o_images[i] = o; 30 images.push_back(o);
28 eo_do(o, 31 o.file_set(::build_path("frame.png"), "");
29 efl_file_set(build_path("frame.png"), NULL), 32 o.border_set(8, 8, 8, 8);
30 evas_obj_image_border_set(8, 8, 8, 8), 33 o.visibility_set(true);
31 evas_obj_visibility_set(EINA_TRUE));
32 } 34 }
33 done = 0; 35 done = 0;
34} 36}
@@ -36,16 +38,15 @@ static void _setup(void)
36/* cleanup */ 38/* cleanup */
37static void _cleanup(void) 39static void _cleanup(void)
38{ 40{
39 int i; 41 images.clear();
40 for (i = 0; i < OBNUM; i++) eo_del(o_images[i]);
41} 42}
42 43
43/* loop - do things */ 44/* loop - do things */
44static void _loop(double t, int f) 45static void _loop(double t, int f)
45{ 46{
46 int i; 47 int i = 0;
47 Evas_Coord x, y, w, h, w0, h0; 48 Evas_Coord x, y, w, h, w0, h0;
48 for (i = 0; i < OBNUM; i++) 49 for (auto it = images.begin(), end = images.end(); it != end; it++, i++)
49 { 50 {
50 w0 = 80; 51 w0 = 80;
51 h0 = 80; 52 h0 = 80;
@@ -55,10 +56,9 @@ static void _loop(double t, int f)
55 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w0 / 2); 56 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w0 / 2);
56 y = (win_h / 2) - (h / 2); 57 y = (win_h / 2) - (h / 2);
57 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h0 / 2); 58 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h0 / 2);
58 eo_do(o_images[i], 59 (*it).position_set(x, y);
59 evas_obj_position_set(x, y), 60 (*it).evas::object::size_set(w, h);
60 evas_obj_size_set(w, h), 61 (*it).fill_set(0, 0, w, h);
61 evas_obj_image_fill_set(0, 0, w, h));
62 } 62 }
63 FPS_STD(NAME); 63 FPS_STD(NAME);
64} 64}
@@ -69,38 +69,9 @@ static void _key(char *key)
69 KEY_STD; 69 KEY_STD;
70} 70}
71 71
72 72extern "C" void FNAME(void)
73
74
75
76
77
78
79
80
81
82
83/* template stuff - ignore */
84# endif
85#endif
86
87#ifdef UI
88_ui_menu_item_add(ICON, NAME, FNAME);
89#endif
90
91#ifdef PROTO
92void FNAME(void);
93#endif
94
95#ifndef PROTO
96# ifndef UI
97void FNAME(void)
98{ 73{
99 ui_func_set(_key, _loop); 74 ui_func_set(_key, _loop);
100 _setup(); 75 _setup();
101} 76}
102# endif 77
103#endif
104#undef FNAME
105#undef NAME
106#undef ICON
diff --git a/src/bin/cxx/image_blend_solid_fade_pow2_unscaled.cc b/src/bin/cxx/image_blend_solid_fade_pow2_unscaled.cc
index 1967554..6520769 100644
--- a/src/bin/cxx/image_blend_solid_fade_pow2_unscaled.cc
+++ b/src/bin/cxx/image_blend_solid_fade_pow2_unscaled.cc
@@ -1,41 +1,40 @@
1#undef FNAME
2#undef NAME
3#undef ICON
4 1
5/* metadata */ 2#ifdef HAVE_CONFIG_H
6#define FNAME image_blend_solid_fade_pow2_unscaled_start 3# include <config.h>
7#define NAME "Image Blend Solid Fade Power 2 Unscaled" 4#endif
8#define ICON "blend.png" 5
6#include "Eo.h"
7#include "Evas.h"
8
9#include "Eo.hh"
10#include "Eina.hh"
11#include "Evas.hh"
9 12
10#ifndef PROTO 13#include "main.h"
11# ifndef UI 14
12# include "main.h" 15#define EXPEDITE_CXX_TEST_IMPL
16#include "image_blend_solid_fade_pow2_unscaled_capi.h"
17
18static efl::eina::list<evas::image> images;
13 19
14/* standard var */ 20/* standard var */
15static int done = 0; 21static int done = 0;
16/* private data */
17static Evas_Object *o_images[OBNUM];
18 22
19/* setup */ 23/* setup */
20static void _setup(void) 24static void _setup(void)
21{ 25{
22 int i; 26 evas::canvas canvas(::eo_ref(G_evas));
23 Evas_Object *o; 27 for (int i = 0; i < OBNUM; i++)
24 for (i = 0; i < OBNUM; i++)
25 { 28 {
26 int a; 29 evas::image o(efl::eo::parent = canvas);
27 30 images.push_back(o);
28 o = eo_add(EVAS_IMAGE_CLASS, G_evas); 31 o.file_set(::build_path("image.png"), "");
29 o_images[i] = o; 32 o.fill_set(0, 0, 120, 160);
30 eo_do(o, 33 o.evas::object::size_set(120, 160);
31 efl_file_set(build_path("image.png"), NULL), 34 int a = 256 - (1 << ((rnd() % 8) + 1));
32 evas_obj_image_fill_set(0, 0, 120, 160),
33 evas_obj_size_set(120, 160));
34 a = 256 - (1 << ((rnd() % 8) + 1));
35 if (a < 128) a = 128; 35 if (a < 128) a = 128;
36 eo_do(o, 36 o.color_set(a, a, a, a);
37 evas_obj_color_set(a, a, a, a), 37 o.visibility_set(true);
38 evas_obj_visibility_set(EINA_TRUE));
39 } 38 }
40 done = 0; 39 done = 0;
41} 40}
@@ -43,16 +42,15 @@ static void _setup(void)
43/* cleanup */ 42/* cleanup */
44static void _cleanup(void) 43static void _cleanup(void)
45{ 44{
46 int i; 45 images.clear();
47 for (i = 0; i < OBNUM; i++) eo_del(o_images[i]);
48} 46}
49 47
50/* loop - do things */ 48/* loop - do things */
51static void _loop(double t, int f) 49static void _loop(double t, int f)
52{ 50{
53 int i; 51 int i = 0;
54 Evas_Coord x, y, w, h; 52 Evas_Coord x, y, w, h;
55 for (i = 0; i < OBNUM; i++) 53 for (auto it = images.begin(), end = images.end(); it != end; it++, i++)
56 { 54 {
57 w = 120; 55 w = 120;
58 h = 160; 56 h = 160;
@@ -60,7 +58,7 @@ static void _loop(double t, int f)
60 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2); 58 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
61 y = (win_h / 2) - (h / 2); 59 y = (win_h / 2) - (h / 2);
62 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2); 60 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2);
63 eo_do(o_images[i], evas_obj_position_set(x, y)); 61 (*it).position_set(x, y);
64 } 62 }
65 FPS_STD(NAME); 63 FPS_STD(NAME);
66} 64}
@@ -71,38 +69,8 @@ static void _key(char *key)
71 KEY_STD; 69 KEY_STD;
72} 70}
73 71
74 72extern "C" void FNAME(void)
75
76
77
78
79
80
81
82
83
84
85/* template stuff - ignore */
86# endif
87#endif
88
89#ifdef UI
90_ui_menu_item_add(ICON, NAME, FNAME);
91#endif
92
93#ifdef PROTO
94void FNAME(void);
95#endif
96
97#ifndef PROTO
98# ifndef UI
99void FNAME(void)
100{ 73{
101 ui_func_set(_key, _loop); 74 ui_func_set(_key, _loop);
102 _setup(); 75 _setup();
103} 76}
104# endif
105#endif
106#undef FNAME
107#undef NAME
108#undef ICON
diff --git a/src/bin/cxx/image_blend_solid_fade_unscaled.cc b/src/bin/cxx/image_blend_solid_fade_unscaled.cc
index bb09de2..2e61e96 100644
--- a/src/bin/cxx/image_blend_solid_fade_unscaled.cc
+++ b/src/bin/cxx/image_blend_solid_fade_unscaled.cc
@@ -1,40 +1,40 @@
1#undef FNAME
2#undef NAME
3#undef ICON
4 1
5/* metadata */ 2#ifdef HAVE_CONFIG_H
6#define FNAME image_blend_solid_fade_unscaled_start 3# include <config.h>
7#define NAME "Image Blend Solid Fade Unscaled" 4#endif
8#define ICON "blend.png" 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"
9 14
10#ifndef PROTO 15#define EXPEDITE_CXX_TEST_IMPL
11# ifndef UI 16#include "image_blend_solid_fade_unscaled_capi.h"
12# include "main.h" 17
18static efl::eina::list<evas::image> images;
13 19
14/* standard var */ 20/* standard var */
15static int done = 0; 21static int done = 0;
16/* private data */
17static Evas_Object *o_images[OBNUM];
18 22
19/* setup */ 23/* setup */
20static void _setup(void) 24static void _setup(void)
21{ 25{
22 int i; 26 evas::canvas canvas(::eo_ref(G_evas));
23 Evas_Object *o; 27 for (int i = 0; i < OBNUM; i++)
24 for (i = 0; i < OBNUM; i++)
25 { 28 {
26 int a; 29 evas::image o(efl::eo::parent = canvas);
27 30 images.push_back(o);
28 o = eo_add(EVAS_IMAGE_CLASS, G_evas); 31
29 o_images[i] = o; 32 o.file_set(::build_path("image.png"), NULL);
30 eo_do(o, 33 o.fill_set(0, 0, 120, 160);
31 efl_file_set(build_path("image.png"), NULL), 34 o.evas::object::size_set(120, 160);
32 evas_obj_image_fill_set(0, 0, 120, 160), 35 int a = rnd()&0xff;
33 evas_obj_size_set(120, 160)); 36 o.color_set(a, a, a, a);
34 a = rnd()&0xff; 37 o.visibility_set(true);
35 eo_do(o,
36 evas_obj_color_set(a, a, a, a),
37 evas_obj_visibility_set(EINA_TRUE));
38 } 38 }
39 done = 0; 39 done = 0;
40} 40}
@@ -42,16 +42,16 @@ static void _setup(void)
42/* cleanup */ 42/* cleanup */
43static void _cleanup(void) 43static void _cleanup(void)
44{ 44{
45 int i; 45 images.clear();
46 for (i = 0; i < OBNUM; i++) eo_del(o_images[i]);
47} 46}
48 47
49/* loop - do things */ 48/* loop - do things */
50static void _loop(double t, int f) 49static void _loop(double t, int f)
51{ 50{
52 int i; 51 int i = 0;
53 Evas_Coord x, y, w, h; 52 Evas_Coord x, y, w, h;
54 for (i = 0; i < OBNUM; i++) 53
54 for (auto it = images.begin(), end = images.end(); it != end; it++, i++)
55 { 55 {
56 w = 120; 56 w = 120;
57 h = 160; 57 h = 160;
@@ -59,7 +59,7 @@ static void _loop(double t, int f)
59 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2); 59 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
60 y = (win_h / 2) - (h / 2); 60 y = (win_h / 2) - (h / 2);
61 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2); 61 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2);
62 eo_do(o_images[i], evas_obj_position_set(x, y)); 62 (*it).position_set(x, y);
63 } 63 }
64 FPS_STD(NAME); 64 FPS_STD(NAME);
65} 65}
@@ -70,38 +70,8 @@ static void _key(char *key)
70 KEY_STD; 70 KEY_STD;
71} 71}
72 72
73 73extern "C" void FNAME(void)
74
75
76
77
78
79
80
81
82
83
84/* template stuff - ignore */
85# endif
86#endif
87
88#ifdef UI
89_ui_menu_item_add(ICON, NAME, FNAME);
90#endif
91
92#ifdef PROTO
93void FNAME(void);
94#endif
95
96#ifndef PROTO
97# ifndef UI
98void FNAME(void)
99{ 74{
100 ui_func_set(_key, _loop); 75 ui_func_set(_key, _loop);
101 _setup(); 76 _setup();
102} 77}
103# endif
104#endif
105#undef FNAME
106#undef NAME
107#undef ICON
diff --git a/src/bin/cxx/image_blend_solid_unscaled.cc b/src/bin/cxx/image_blend_solid_unscaled.cc
new file mode 100644
index 0000000..8c97982
--- /dev/null
+++ b/src/bin/cxx/image_blend_solid_unscaled.cc
@@ -0,0 +1,74 @@
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 "image_blend_solid_unscaled_capi.h"
17
18static efl::eina::list<evas::image> images;
19
20/* standard var */
21static int done = 0;
22
23/* setup */
24static void _setup(void)
25{
26 evas::canvas canvas(::eo_ref(G_evas));
27 for (int i = 0; i < OBNUM; i++)
28 {
29 evas::image o(efl::eo::parent = canvas);
30 images.push_back(o);
31 o.file_set(::build_path("image.png"), "");
32 o.fill_set(0, 0, 120, 160);
33 o.size_set(120, 160);
34 o.visibility_set(true);
35 }
36 done = 0;
37}
38
39/* cleanup */
40static void _cleanup(void)
41{
42 images.clear();
43}
44
45/* loop - do things */
46static void _loop(double t, int f)
47{
48 int i = 0;
49 Evas_Coord x, y, w, h;
50 for (auto it = images.begin(), end = images.end(); it != end; it++, i++)
51 {
52 w = 120;
53 h = 160;
54 x = (win_w / 2) - (w / 2);
55 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2);
56 y = (win_h / 2) - (h / 2);
57 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2);
58 (*it).position_set(x, y);
59 }
60 FPS_STD(NAME);
61}
62
63/* prepend special key handlers if interactive (before STD) */
64static void _key(char *key)
65{
66 KEY_STD;
67}
68
69extern "C" void FNAME(void)
70{
71 ui_func_set(_key, _loop);
72 _setup();
73}
74
diff --git a/src/bin/cxx/image_blend_solid_unscaled_capi.h b/src/bin/cxx/image_blend_solid_unscaled_capi.h
new file mode 100644
index 0000000..b1e20c2
--- /dev/null
+++ b/src/bin/cxx/image_blend_solid_unscaled_capi.h
@@ -0,0 +1,32 @@
1
2#ifdef __cplusplus
3extern "C" {
4#endif
5
6#undef FNAME
7#undef NAME
8#undef ICON
9
10/* metadata */
11#define FNAME image_blend_solid_unscaled_cxx_start
12#define NAME "Image Blend Solid Unscaled (C++)"
13#define ICON "blend.png"
14
15#ifdef UI
16_ui_menu_item_add(ICON, NAME, FNAME);
17#endif
18
19#ifdef PROTO
20void FNAME(void);
21#endif
22
23#ifndef EXPEDITE_CXX_TEST_IMPL
24#undef FNAME
25#undef NAME
26#undef ICON
27#endif
28
29#ifdef __cplusplus
30}
31#endif
32
diff --git a/src/bin/tests.h b/src/bin/tests.h
index 22c39a9..d92de4e 100644
--- a/src/bin/tests.h
+++ b/src/bin/tests.h
@@ -4,14 +4,15 @@ extern "C" {
4#endif 4#endif
5 5
6// C++ tests 6// C++ tests
7#include "cxx/image_blend_fade_unscaled_capi.h"
8#include "cxx/image_blend_fade_pow2_unscaled_capi.h"
9#include "cxx/image_blend_border_capi.h" 7#include "cxx/image_blend_border_capi.h"
10#include "cxx/image_blend_border_recolor_capi.h" 8#include "cxx/image_blend_border_recolor_capi.h"
9#include "cxx/image_blend_fade_pow2_unscaled_capi.h"
10#include "cxx/image_blend_fade_unscaled_capi.h"
11 11
12#include "cxx/image_blend_solid_border_capi.h" 12#include "cxx/image_blend_solid_border_capi.h"
13#include "cxx/image_blend_solid_fade_pow2_unscaled_capi.h" 13#include "cxx/image_blend_solid_fade_pow2_unscaled_capi.h"
14#include "cxx/image_blend_solid_fade_unscaled_capi.h" 14#include "cxx/image_blend_solid_fade_unscaled_capi.h"
15#include "cxx/image_blend_solid_unscaled_capi.h"
15 16
16// C tests 17// C tests
17/* #include "widgets_file_icons.c" */ 18/* #include "widgets_file_icons.c" */