diff options
author | Savio Sena <savio@expertisesolutions.com.br> | 2014-08-28 18:03:08 -0300 |
---|---|---|
committer | Savio Sena <savio@expertisesolutions.com.br> | 2014-09-16 19:35:19 -0300 |
commit | 2edb6402d654e4fd5f87e1d8ccecae30476e41a2 (patch) | |
tree | 7f26deab61e55f7d6fbcdfebb645060bca875953 | |
parent | a6d52a18769fed65c272a81776d8449c0a164fac (diff) |
Added more image/C++ tests.
-rw-r--r-- | src/bin/Makefile.am | 8 | ||||
-rw-r--r-- | src/bin/cxx/image_blend_border.cc | 2 | ||||
-rw-r--r-- | src/bin/cxx/image_blend_border_capi.h (renamed from src/bin/cxx/image_blend_border_cxx.c) | 0 | ||||
-rw-r--r-- | src/bin/cxx/image_blend_border_recolor.cc | 4 | ||||
-rw-r--r-- | src/bin/cxx/image_blend_border_recolor_capi.h (renamed from src/bin/cxx/image_blend_border_recolor_cxx.c) | 0 | ||||
-rw-r--r-- | src/bin/cxx/image_blend_fade_pow2_unscaled.cc | 79 | ||||
-rw-r--r-- | src/bin/cxx/image_blend_fade_pow2_unscaled_capi.h | 33 | ||||
-rw-r--r-- | src/bin/cxx/image_blend_fade_unscaled.cc | 76 | ||||
-rw-r--r-- | src/bin/cxx/image_blend_fade_unscaled_capi.h | 33 | ||||
-rw-r--r-- | src/bin/tests.h | 6 |
10 files changed, 234 insertions, 7 deletions
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 \ | |||
36 | image_blend_unscaled.c \ | 36 | image_blend_unscaled.c \ |
37 | image_blend_solid_middle_unscaled.c \ | 37 | image_blend_solid_middle_unscaled.c \ |
38 | image_blend_fade_unscaled.c \ | 38 | image_blend_fade_unscaled.c \ |
39 | cxx/image_blend_fade_unscaled.cc \ | ||
40 | cxx/image_blend_fade_unscaled_capi.h \ | ||
39 | image_blend_fade_pow2_unscaled.c \ | 41 | image_blend_fade_pow2_unscaled.c \ |
42 | cxx/image_blend_fade_pow2_unscaled.cc \ | ||
43 | ocxx/image_blend_fade_pow2_unscaled_capi.h \ | ||
40 | image_blend_solid_unscaled.c \ | 44 | image_blend_solid_unscaled.c \ |
41 | image_blend_solid_fade_unscaled.c \ | 45 | image_blend_solid_fade_unscaled.c \ |
42 | image_blend_solid_fade_pow2_unscaled.c \ | 46 | image_blend_solid_fade_pow2_unscaled.c \ |
@@ -50,10 +54,10 @@ image_blend_smooth_same_scaled.c \ | |||
50 | image_blend_smooth_solid_same_scaled.c \ | 54 | image_blend_smooth_solid_same_scaled.c \ |
51 | image_blend_border.c \ | 55 | image_blend_border.c \ |
52 | cxx/image_blend_border.cc \ | 56 | cxx/image_blend_border.cc \ |
53 | cxx/image_blend_border_cxx.c \ | 57 | cxx/image_blend_border_capi.h \ |
54 | image_blend_border_recolor.c \ | 58 | image_blend_border_recolor.c \ |
55 | cxx/image_blend_border_recolor.cc \ | 59 | cxx/image_blend_border_recolor.cc \ |
56 | cxx/image_blend_border_recolor_cxx.c \ | 60 | cxx/image_blend_border_recolor_capi.h \ |
57 | image_blend_solid_middle_border.c \ | 61 | image_blend_solid_middle_border.c \ |
58 | image_blend_solid_border.c \ | 62 | image_blend_solid_border.c \ |
59 | image_map_rotate.c \ | 63 | 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 @@ | |||
13 | #include "main.h" | 13 | #include "main.h" |
14 | 14 | ||
15 | #define EXPEDITE_CXX_TEST_IMPL | 15 | #define EXPEDITE_CXX_TEST_IMPL |
16 | #include "image_blend_border_cxx.c" | 16 | #include "image_blend_border_capi.h" |
17 | 17 | ||
18 | static efl::eina::list<evas::image> images; | 18 | static efl::eina::list<evas::image> images; |
19 | 19 | ||
diff --git a/src/bin/cxx/image_blend_border_cxx.c b/src/bin/cxx/image_blend_border_capi.h index 1e3258a..1e3258a 100644 --- a/src/bin/cxx/image_blend_border_cxx.c +++ b/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 @@ | |||
13 | #include "main.h" | 13 | #include "main.h" |
14 | 14 | ||
15 | #define EXPEDITE_CXX_TEST_IMPL | 15 | #define EXPEDITE_CXX_TEST_IMPL |
16 | #include "image_blend_border_recolor_cxx.c" | 16 | #include "image_blend_border_recolor_capi.h" |
17 | 17 | ||
18 | efl::eina::list<evas::image> images; | 18 | efl::eina::list<evas::image> images; |
19 | 19 | ||
@@ -28,7 +28,7 @@ static void _setup(void) | |||
28 | { | 28 | { |
29 | evas::image o(efl::eo::parent = canvas); | 29 | evas::image o(efl::eo::parent = canvas); |
30 | images.push_back(o); | 30 | images.push_back(o); |
31 | o.file_set(::build_path("bar.png"), ""); | 31 | o.file_set(::build_path("pan.png"), ""); |
32 | o.color_set(64, 64, 64, 255); | 32 | o.color_set(64, 64, 64, 255); |
33 | o.border_set(3, 3, 3, 3); | 33 | o.border_set(3, 3, 3, 3); |
34 | o.visibility_set(true); | 34 | 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 index b8685ba..b8685ba 100644 --- a/src/bin/cxx/image_blend_border_recolor_cxx.c +++ b/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 @@ | |||
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_fade_pow2_unscaled_capi.h" | ||
17 | |||
18 | static efl::eina::list<evas::image> images; | ||
19 | |||
20 | /* standard var */ | ||
21 | static int done = 0; | ||
22 | |||
23 | /* setup */ | ||
24 | static 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 | |||
32 | o.file_set(::build_path("logo.png"), ""); | ||
33 | o.fill_set(0, 0, 120, 160); | ||
34 | o.evas::object::size_set(120, 160); | ||
35 | |||
36 | int a = 256 - (1 << ((rnd() % 8) + 1)); | ||
37 | if (a < 128) a = 128; | ||
38 | |||
39 | o.color_set(a, a, a, a); | ||
40 | o.visibility_set(true); | ||
41 | } | ||
42 | done = 0; | ||
43 | } | ||
44 | |||
45 | /* cleanup */ | ||
46 | static void _cleanup(void) | ||
47 | { | ||
48 | images.clear(); | ||
49 | } | ||
50 | |||
51 | /* loop - do things */ | ||
52 | static void _loop(double t, int f) | ||
53 | { | ||
54 | int i = 0; | ||
55 | Evas_Coord x, y, w, h; | ||
56 | for (auto it = images.begin(), end = images.end(); it != end; it++, i++) | ||
57 | { | ||
58 | w = 120; | ||
59 | h = 160; | ||
60 | x = (win_w / 2) - (w / 2); | ||
61 | x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2); | ||
62 | y = (win_h / 2) - (h / 2); | ||
63 | y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2); | ||
64 | (*it).position_set(x, y); | ||
65 | } | ||
66 | FPS_STD(NAME); | ||
67 | } | ||
68 | |||
69 | /* prepend special key handlers if interactive (before STD) */ | ||
70 | static void _key(char *key) | ||
71 | { | ||
72 | KEY_STD; | ||
73 | } | ||
74 | |||
75 | extern "C" void FNAME(void) | ||
76 | { | ||
77 | ui_func_set(_key, _loop); | ||
78 | _setup(); | ||
79 | } | ||
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 @@ | |||
1 | |||
2 | #ifdef __cplusplus | ||
3 | extern "C" { | ||
4 | #endif | ||
5 | |||
6 | #undef FNAME | ||
7 | #undef NAME | ||
8 | #undef ICON | ||
9 | |||
10 | /* metadata */ | ||
11 | #define FNAME image_blend_fade_pow2_unscaled_cxx_start | ||
12 | #define NAME "Image Blend Fade Power 2 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 | ||
20 | void 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 | |||
33 | |||
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 @@ | |||
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_fade_unscaled_capi.h" | ||
17 | |||
18 | /* standard var */ | ||
19 | static int done = 0; | ||
20 | /* private data */ | ||
21 | static efl::eina::list<evas::image> images; | ||
22 | |||
23 | /* setup */ | ||
24 | static 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("logo.png"), ""); | ||
32 | o.fill_set(0, 0, 120, 160); | ||
33 | o.evas::object::size_set(120, 160); | ||
34 | |||
35 | int a = rnd()&0xff; | ||
36 | o.color_set(a, a, a, a); | ||
37 | o.visibility_set(true); | ||
38 | } | ||
39 | done = 0; | ||
40 | } | ||
41 | |||
42 | /* cleanup */ | ||
43 | static void _cleanup(void) | ||
44 | { | ||
45 | images.clear(); | ||
46 | } | ||
47 | |||
48 | /* loop - do things */ | ||
49 | static void _loop(double t, int f) | ||
50 | { | ||
51 | int i = 0; | ||
52 | Evas_Coord x, y, w, h; | ||
53 | for (auto it = images.begin(), end = images.end(); it != end; it++, i++) | ||
54 | { | ||
55 | w = 120; | ||
56 | h = 160; | ||
57 | x = (win_w / 2) - (w / 2); | ||
58 | x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w / 2); | ||
59 | y = (win_h / 2) - (h / 2); | ||
60 | y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h / 2); | ||
61 | (*it).position_set(x, y); | ||
62 | } | ||
63 | FPS_STD(NAME); | ||
64 | } | ||
65 | |||
66 | /* prepend special key handlers if interactive (before STD) */ | ||
67 | static void _key(char *key) | ||
68 | { | ||
69 | KEY_STD; | ||
70 | } | ||
71 | |||
72 | extern "C" void FNAME(void) | ||
73 | { | ||
74 | ui_func_set(_key, _loop); | ||
75 | _setup(); | ||
76 | } | ||
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 @@ | |||
1 | |||
2 | #ifdef __cplusplus | ||
3 | extern "C" { | ||
4 | #endif | ||
5 | |||
6 | #undef FNAME | ||
7 | #undef NAME | ||
8 | #undef ICON | ||
9 | |||
10 | /* metadata */ | ||
11 | #define FNAME image_blend_fade_unscaled_cxx_start | ||
12 | #define NAME "Image Blend Fade 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 | ||
20 | void 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 | |||
33 | |||
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" { | |||
4 | #endif | 4 | #endif |
5 | 5 | ||
6 | // C++ tests | 6 | // C++ tests |
7 | #include "cxx/image_blend_border_cxx.c" | 7 | #include "cxx/image_blend_fade_unscaled_capi.h" |
8 | #include "cxx/image_blend_border_recolor_cxx.c" | 8 | #include "cxx/image_blend_fade_pow2_unscaled_capi.h" |
9 | #include "cxx/image_blend_border_capi.h" | ||
10 | #include "cxx/image_blend_border_recolor_capi.h" | ||
9 | 11 | ||
10 | // C tests | 12 | // C tests |
11 | /* #include "widgets_file_icons.c" */ | 13 | /* #include "widgets_file_icons.c" */ |