summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSavio Sena <savio@expertisesolutions.com.br>2014-10-06 18:37:03 -0300
committerSavio Sena <savio@expertisesolutions.com.br>2014-10-06 18:37:03 -0300
commit55a7eae96fb77f877d88e318a10a3108c15052cc (patch)
tree14f1d9f5aefd5ede779b49e5db6a67b7d4cf4ec4
parent2a2cc7260cfcb12bdbb177abf848b7ea4794fcb9 (diff)
expedite-cxx: Finished textblock tests.
-rw-r--r--src/bin/cxx/textblock_auto_align.cc41
-rw-r--r--src/bin/cxx/textblock_basic.cc43
-rw-r--r--src/bin/cxx/textblock_intl.cc44
-rw-r--r--src/bin/cxx/textblock_text_append.cc45
4 files changed, 74 insertions, 99 deletions
diff --git a/src/bin/cxx/textblock_auto_align.cc b/src/bin/cxx/textblock_auto_align.cc
index 8e822e5..97005f8 100644
--- a/src/bin/cxx/textblock_auto_align.cc
+++ b/src/bin/cxx/textblock_auto_align.cc
@@ -19,26 +19,21 @@
19static int done = 0; 19static int done = 0;
20 20
21/* private data */ 21/* private data */
22//static evas::textblock text; // XXX not allowed to 22static evas::textblock *text_block;
23 23
24/* setup */ 24/* setup */
25static void _setup(void) 25static void _setup(void)
26{ 26{
27#if 0
28 evas::canvas canvas(::eo_ref(G_evas)); 27 evas::canvas canvas(::eo_ref(G_evas));
29 Evas_Textblock_Style *st; 28 text_block = new evas::textblock(efl::eo::parent = canvas);
30 29 Evas_Textblock_Style *st = ::evas_textblock_style_new();
31 o = eo_add(EVAS_TEXTBLOCK_CLASS, G_evas); 30 ::evas_textblock_style_set
32 o_text = o;
33 st = evas_textblock_style_new();
34 evas_textblock_style_set
35 (st, 31 (st,
36 "DEFAULT='font=Sans font_size=10 color=#000000 wrap=word'" 32 "DEFAULT='font=Sans font_size=10 color=#000000 wrap=word'"
37 ); 33 );
38 eo_do(o, 34 text_block->style_set(st);
39 evas_obj_textblock_style_set(st), 35 text_block->clear();
40 evas_obj_textblock_clear(), 36 text_block->text_markup_set(
41 evas_obj_textblock_text_markup_set(
42 "This is a test of auto alignment in Evas<ps/>" 37 "This is a test of auto alignment in Evas<ps/>"
43 "<br/>" 38 "<br/>"
44 "This text should be left aligned<ps/>" 39 "This text should be left aligned<ps/>"
@@ -56,37 +51,35 @@ static void _setup(void)
56 "words should appear in the following order: 'דוגמה' first, 'of' second,<br/>" 51 "words should appear in the following order: 'דוגמה' first, 'of' second,<br/>"
57 "‎'טקסט' third, 'english' fourth and 'in' fifth, counting from right to left<ps/>" 52 "‎'טקסט' third, 'english' fourth and 'in' fifth, counting from right to left<ps/>"
58 "דוגמה of טקסט in english." 53 "דוגמה of טקסט in english."
59 ), 54 );
60 evas_obj_visibility_set(EINA_TRUE)); 55 text_block->visibility_set(true);
61 evas_textblock_style_free(st); 56 ::evas_textblock_style_free(st);
62
63 done = 0; 57 done = 0;
64#endif // XXX
65} 58}
66 59
67/* cleanup */ 60/* cleanup */
68static void _cleanup(void) 61static void _cleanup(void)
69{ 62{
63 text_block->parent_set(efl::eo::base(nullptr));
64 delete text_block;
70} 65}
71 66
72/* loop - do things */ 67/* loop - do things */
73static void _loop(double t, int f) 68static void _loop(double t, int f)
74{ 69{
75#if 0
76 Evas_Coord x, y, w, h, w0, h0; 70 Evas_Coord x, y, w, h, w0, h0;
77 int i = 0; 71 int i = 0;
72 if (!text_block) goto fps; // XXX
78 73
79 eo_do(o_text, evas_obj_textblock_size_native_get(&w0, &h0)); 74 text_block->size_native_get(&w0, &h0);
80 w = w0; 75 w = w0;
81 h = h0; 76 h = h0;
82 w += fabs(sin((double)(f + (i * 13)) / (31.1 * SLOW))) * (w0); 77 w += fabs(sin((double)(f + (i * 13)) / (31.1 * SLOW))) * (w0);
83 x = (win_w / 2) - (w / 2); 78 x = (win_w / 2) - (w / 2);
84 y = (win_h / 2) - (h0 / 2); 79 y = (win_h / 2) - (h0 / 2);
85 eo_do(o_text, 80 text_block->evas::object::position_set(x, y);
86 evas_obj_position_set(x, y), 81 text_block->evas::object::size_set(w, h);
87 evas_obj_size_set(w, h)); 82 fps:
88
89#endif /// XXX
90 FPS_STD(NAME); 83 FPS_STD(NAME);
91} 84}
92 85
diff --git a/src/bin/cxx/textblock_basic.cc b/src/bin/cxx/textblock_basic.cc
index 9a905ff..567568d 100644
--- a/src/bin/cxx/textblock_basic.cc
+++ b/src/bin/cxx/textblock_basic.cc
@@ -19,19 +19,16 @@
19static int done = 0; 19static int done = 0;
20 20
21/* private data */ 21/* private data */
22// static evas::text text; // XXX not allowed to 22static evas::textblock *text_block;
23 23
24/* setup */ 24/* setup */
25static void _setup(void) 25static void _setup(void)
26{ 26{
27#if 0 27
28 Evas_Object *o; 28 evas::canvas canvas(::eo_ref(G_evas));
29 Evas_Textblock_Style *st; 29 text_block = new evas::textblock(efl::eo::parent = canvas);
30 30 Evas_Textblock_Style *st = ::evas_textblock_style_new();
31 o = eo_add(EVAS_TEXTBLOCK_CLASS, G_evas); 31 ::evas_textblock_style_set
32 o_text = o;
33 st = evas_textblock_style_new();
34 evas_textblock_style_set
35 (st, 32 (st,
36 "DEFAULT='font=Vera,Kochi font_size=8 align=left color=#000000 wrap=word'" 33 "DEFAULT='font=Vera,Kochi font_size=8 align=left color=#000000 wrap=word'"
37 "center='+ font=Vera,Kochi font_size=10 align=center'" 34 "center='+ font=Vera,Kochi font_size=10 align=center'"
@@ -44,10 +41,9 @@ static void _setup(void)
44 "p='+ font=Vera,Kochi font_size=10 align=left'" 41 "p='+ font=Vera,Kochi font_size=10 align=left'"
45 "/p='- \n'" 42 "/p='- \n'"
46 ); 43 );
47 eo_do(o, 44 text_block->style_set(st);
48 evas_obj_textblock_style_set(st), 45 text_block->clear();
49 evas_obj_textblock_clear(), 46 text_block->text_markup_set(
50 evas_obj_textblock_text_markup_set(
51 "<center><h1>Title</h1></center><br/>" 47 "<center><h1>Title</h1></center><br/>"
52 "<p><tab>A pragraph here <red>red text</red> and stuff.</p>" 48 "<p><tab>A pragraph here <red>red text</red> and stuff.</p>"
53 "<p>And escaping &lt; and &gt; as well as &amp; as <h1>normal.</h1></p>" 49 "<p>And escaping &lt; and &gt; as well as &amp; as <h1>normal.</h1></p>"
@@ -116,27 +112,27 @@ static void _setup(void)
116 "Heizölrückstoßabdämpfung fløde pingüino kilómetros cœur déçu l'âme " 112 "Heizölrückstoßabdämpfung fløde pingüino kilómetros cœur déçu l'âme "
117 "plutôt naïve Louÿs rêva crapaüter Íosa Úrmhac Óighe pór Éava Ádhaim" 113 "plutôt naïve Louÿs rêva crapaüter Íosa Úrmhac Óighe pór Éava Ádhaim"
118 "</blockquote>" 114 "</blockquote>"
119 ), 115 );
120 evas_obj_visibility_set(EINA_TRUE)); 116 text_block->visibility_set(true);
121 117 ::evas_textblock_style_free(st);
122 evas_textblock_style_free(st);
123 118
124 done = 0; 119 done = 0;
125#endif // XXX
126} 120}
127 121
128/* cleanup */ 122/* cleanup */
129static void _cleanup(void) 123static void _cleanup(void)
130{ 124{
125 text_block->parent_set(efl::eo::base(nullptr));
126 delete text_block;
131} 127}
132 128
133/* loop - do things */ 129/* loop - do things */
134static void _loop(double t, int f) 130static void _loop(double t, int f)
135{ 131{
136#if 0
137 Evas_Coord x, y, w, h, w0, h0; 132 Evas_Coord x, y, w, h, w0, h0;
138 int i = 0; 133 int i = 0;
139 134
135 if (!text_block) goto fps; // XXX
140 w0 = 160; 136 w0 = 160;
141 h0 = 120; 137 h0 = 120;
142 w = 150 + ((1.0 + cos((double)(f + (i * 10)) / (37.4 * SLOW) )) * w0 * 2); 138 w = 150 + ((1.0 + cos((double)(f + (i * 10)) / (37.4 * SLOW) )) * w0 * 2);
@@ -145,11 +141,10 @@ static void _loop(double t, int f)
145 x += sin((double)(f + (i * 13)) / (86.7 * SLOW)) * (w0 / 2); 141 x += sin((double)(f + (i * 13)) / (86.7 * SLOW)) * (w0 / 2);
146 y = (win_h / 2) - (h / 2); 142 y = (win_h / 2) - (h / 2);
147 y += cos((double)(f + (i * 28)) / (93.8 * SLOW)) * (h0 / 2); 143 y += cos((double)(f + (i * 28)) / (93.8 * SLOW)) * (h0 / 2);
148 eo_do(o_text, 144 text_block->evas::object::position_set(x, y);
149 evas_obj_position_set(x, y), 145 text_block->evas::object::size_set(w, 5000);
150 evas_obj_size_set(w, 5000)); 146 fps:
151#endif 147 FPS_STD(NAME);
152 FPS_STD(NAME);
153} 148}
154 149
155static void _key(char *key) 150static void _key(char *key)
diff --git a/src/bin/cxx/textblock_intl.cc b/src/bin/cxx/textblock_intl.cc
index ded74f7..afef9ad 100644
--- a/src/bin/cxx/textblock_intl.cc
+++ b/src/bin/cxx/textblock_intl.cc
@@ -19,26 +19,21 @@
19static int done = 0; 19static int done = 0;
20 20
21/* private data */ 21/* private data */
22//evas::text text; // XXX not allowed to 22evas::textblock *text_block;
23 23
24/* setup */ 24/* setup */
25static void _setup(void) 25static void _setup(void)
26{ 26{
27#if 0 27 evas::canvas canvas(::eo_ref(G_evas));
28 Evas_Object *o; 28 text_block = new evas::textblock(efl::eo::parent = canvas);
29 Evas_Textblock_Style *st; 29 Evas_Textblock_Style *st = ::evas_textblock_style_new();
30 30 ::evas_textblock_style_set
31 o = eo_add(EVAS_TEXTBLOCK_CLASS, G_evas);
32 o_text = o;
33 st = evas_textblock_style_new();
34 evas_textblock_style_set
35 (st, 31 (st,
36 "DEFAULT='font=Sans font_size=10 align=left color=#000000 wrap=word'" 32 "DEFAULT='font=Sans font_size=10 align=left color=#000000 wrap=word'"
37 ); 33 );
38 eo_do(o, 34 text_block->style_set(st);
39 evas_obj_textblock_style_set(st), 35 text_block->clear();
40 evas_obj_textblock_clear(), 36 text_block->text_markup_set(
41 evas_obj_textblock_text_markup_set(
42 "This is a test of International test rendering in Evas<br/>" 37 "This is a test of International test rendering in Evas<br/>"
43 "<br/>" 38 "<br/>"
44 "Danish: 'Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen'<br/>" 39 "Danish: 'Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen'<br/>"
@@ -87,39 +82,36 @@ static void _setup(void)
87 "Thai: 'ยูนืโคด'<br/>" 82 "Thai: 'ยูนืโคด'<br/>"
88 "Tibetan: 'ཨུ་ནི་ཀོཌྲ།'<br/>" 83 "Tibetan: 'ཨུ་ནི་ཀོཌྲ།'<br/>"
89 "Yiddish: 'יוניקאָד'<br/>" 84 "Yiddish: 'יוניקאָד'<br/>"
90 ), 85 );
91 evas_obj_visibility_set(EINA_TRUE)); 86 text_block->visibility_set(true);
92 87 ::evas_textblock_style_free(st);
93 evas_textblock_style_free(st);
94 88
95 done = 0; 89 done = 0;
96#endif // XXX
97} 90}
98 91
99/* cleanup */ 92/* cleanup */
100static void _cleanup(void) 93static void _cleanup(void)
101{ 94{
95 text_block->parent_set(efl::eo::base(nullptr));
96 delete text_block;
102} 97}
103 98
104/* loop - do things */ 99/* loop - do things */
105static void _loop(double t, int f) 100static void _loop(double t, int f)
106{ 101{
107#if 0
108 Evas_Coord x, y, w, h, w0, h0; 102 Evas_Coord x, y, w, h, w0, h0;
109 int i = 0; 103 int i = 0;
110 104 if (!text_block) goto fps; // XXX
111 eo_do(o_text, evas_obj_textblock_size_native_get(&w0, &h0)); 105 text_block->size_native_get(&w0, &h0);
112 w = w0; 106 w = w0;
113 h = h0; 107 h = h0;
114 x = (win_w / 2) - (w / 2); 108 x = (win_w / 2) - (w / 2);
115 x += sin((double)(f + (i * 13)) / (31.1 * SLOW)) * (w0 / (2 * 2)); 109 x += sin((double)(f + (i * 13)) / (31.1 * SLOW)) * (w0 / (2 * 2));
116 y = (win_h / 2) - (h / 2); 110 y = (win_h / 2) - (h / 2);
117 y += cos((double)(f + (i * 28)) / (19.6 * SLOW)) * (h0 / (2 * 2)); 111 y += cos((double)(f + (i * 28)) / (19.6 * SLOW)) * (h0 / (2 * 2));
118 eo_do(o_text, 112 text_block->evas::object::position_set(x, y);
119 evas_obj_position_set(x, y), 113 text_block->evas::object::size_set(w, h);
120 evas_obj_size_set(w, h)); 114fps:
121
122#endif // XXX
123 FPS_STD(NAME); 115 FPS_STD(NAME);
124} 116}
125 117
diff --git a/src/bin/cxx/textblock_text_append.cc b/src/bin/cxx/textblock_text_append.cc
index 44be4e9..4cfa7b5 100644
--- a/src/bin/cxx/textblock_text_append.cc
+++ b/src/bin/cxx/textblock_text_append.cc
@@ -19,26 +19,21 @@
19static int done = 0; 19static int done = 0;
20 20
21/* private data */ 21/* private data */
22// static evas::text text; // XXX not allowed to 22static evas::textblock *text_block;
23 23
24/* setup */ 24/* setup */
25static void _setup(void) 25static void _setup(void)
26{ 26{
27#if 0 27 evas::canvas canvas(::eo_ref(G_evas));
28 Evas_Object *o; 28 text_block = new evas::textblock(efl::eo::parent = canvas);
29 Evas_Textblock_Style *st; 29 Evas_Textblock_Style *st = ::evas_textblock_style_new();
30 30 ::evas_textblock_style_set
31 o = eo_add(EVAS_TEXTBLOCK_CLASS, G_evas);
32 o_text = o;
33 st = evas_textblock_style_new();
34 evas_textblock_style_set
35 (st, 31 (st,
36 "DEFAULT='font=Sans font_size=10 color=#000000 wrap=word'" 32 "DEFAULT='font=Sans font_size=10 color=#000000 wrap=word'"
37 ); 33 );
38 eo_do(o, 34 text_block->style_set(st);
39 evas_obj_textblock_style_set(st), 35 text_block->clear();
40 evas_obj_textblock_clear(), 36 text_block->text_markup_set(
41 evas_obj_textblock_text_markup_set(
42 "This test just appends and removes text from different paragraphs, it's " 37 "This test just appends and removes text from different paragraphs, it's "
43 "not a very visual test, it's included for benchmarking purposes." 38 "not a very visual test, it's included for benchmarking purposes."
44"<ps/>" 39"<ps/>"
@@ -97,36 +92,37 @@ static void _setup(void)
97"Graphics" 92"Graphics"
98"<ps/>" 93"<ps/>"
99"Enlightenment is built by designers and programmers who want others to be able to do more with less. Some of Enlightenment's libraries do not do anything with graphics at all, but it is the ones that do that are the shining stars of the Enlightenment world.<ps/>Evas is the canvas layer. It is not a drawing library. It is not like OpenGL, Cairo, XRender, GDI, DirectFB etc. It is a scene graph library that retains state of all objects in it. They are created then manipulated until they are no longer needed, at which point they are deleted. This allows the programmer to work in terms that a designer thinks of. It is direct mapping, as opposed to having to convert the concepts into drawing commands in the right order, calculate minimum drawing calls needed to get the job done etc.<ps/>Evas also handles abstracting the rendering mechanism. With zero changes the same application can move from software to OpenGL rendering, as they all use an abstracted scene graph to describe the world (canvas) to Evas. Evas supports multiple targets, but the most useful are the high-speed software rendering engines and OpenGL (as well as OpenGL-ES 2.0).<ps/>Evas not only does quality rendering and compositing, but also can scale, rotate and fully 3D transform objects, allowing for sought-after 3D effects in your interfaces. It supplies these abilities in both software and OpenGL rendering, so you are never caught with unexpected loss of features. The software rendering is even fast enough to provide the 3D without any acceleration on devices for simple uses.<ps/>Edje is a meta-object design library that is somewhere between Flash, PSD, SVG and HTML+CSS. It separates design out from code and into a dynamically loaded data file. This file is compressed and loaded very quickly, along with being cached and shared betweeen instances.<ps/>This allows design to be provided at runtime by different design (EDJ) files, leaving the programmer to worry about overall application implementation and coarse grained UI as opposed to needing to worry about all the little details that the artists may vary even until the day before shipping the product.<br/>" 94"Enlightenment is built by designers and programmers who want others to be able to do more with less. Some of Enlightenment's libraries do not do anything with graphics at all, but it is the ones that do that are the shining stars of the Enlightenment world.<ps/>Evas is the canvas layer. It is not a drawing library. It is not like OpenGL, Cairo, XRender, GDI, DirectFB etc. It is a scene graph library that retains state of all objects in it. They are created then manipulated until they are no longer needed, at which point they are deleted. This allows the programmer to work in terms that a designer thinks of. It is direct mapping, as opposed to having to convert the concepts into drawing commands in the right order, calculate minimum drawing calls needed to get the job done etc.<ps/>Evas also handles abstracting the rendering mechanism. With zero changes the same application can move from software to OpenGL rendering, as they all use an abstracted scene graph to describe the world (canvas) to Evas. Evas supports multiple targets, but the most useful are the high-speed software rendering engines and OpenGL (as well as OpenGL-ES 2.0).<ps/>Evas not only does quality rendering and compositing, but also can scale, rotate and fully 3D transform objects, allowing for sought-after 3D effects in your interfaces. It supplies these abilities in both software and OpenGL rendering, so you are never caught with unexpected loss of features. The software rendering is even fast enough to provide the 3D without any acceleration on devices for simple uses.<ps/>Edje is a meta-object design library that is somewhere between Flash, PSD, SVG and HTML+CSS. It separates design out from code and into a dynamically loaded data file. This file is compressed and loaded very quickly, along with being cached and shared betweeen instances.<ps/>This allows design to be provided at runtime by different design (EDJ) files, leaving the programmer to worry about overall application implementation and coarse grained UI as opposed to needing to worry about all the little details that the artists may vary even until the day before shipping the product.<br/>"
100 ), 95 );
101 evas_obj_position_set(0, 0), 96 text_block->evas::object::position_set(0, 0);
102 evas_obj_size_set(win_w, win_h), 97 text_block->evas::object::size_set(win_w, win_h);
103 evas_obj_visibility_set(EINA_TRUE)); 98 text_block->visibility_set(true);
104 99 ::evas_textblock_style_free(st);
105 evas_textblock_style_free(st);
106 100
107 done = 0; 101 done = 0;
108#endif // XXX
109} 102}
110 103
111/* cleanup */ 104/* cleanup */
112static void _cleanup(void) 105static void _cleanup(void)
113{ 106{
107 text_block->parent_set(efl::eo::base(nullptr));
108 delete text_block;
114} 109}
115 110
116/* loop - do things */ 111/* loop - do things */
117static void _loop(double t, int f) 112static void _loop(double t, int f)
118{ 113{
119#if 0
120 Evas_Textblock_Cursor *cur; 114 Evas_Textblock_Cursor *cur;
121 static Evas_Textblock_Cursor *cur2; 115 static Evas_Textblock_Cursor *cur2;
122 eo_do(o_text, cur = evas_obj_textblock_cursor_get()); 116 if (!text_block) goto fps; // XXX
117
118 cur = text_block->cursor_get();
123 evas_textblock_cursor_text_append(cur, "*"); 119 evas_textblock_cursor_text_append(cur, "*");
124 evas_textblock_cursor_char_delete(cur); 120 evas_textblock_cursor_char_delete(cur);
125 121
126 evas_textblock_cursor_paragraph_char_first(cur); 122 evas_textblock_cursor_paragraph_char_first(cur);
127 if (!cur2) 123 if (!cur2)
128 { 124 {
129 eo_do(o_text, cur2 = evas_obj_textblock_cursor_new()); 125 cur2 = text_block->cursor_new();
130 evas_textblock_cursor_paragraph_last(cur2); 126 evas_textblock_cursor_paragraph_last(cur2);
131 evas_textblock_cursor_paragraph_char_first(cur2); 127 evas_textblock_cursor_paragraph_char_first(cur2);
132 } 128 }
@@ -134,8 +130,7 @@ static void _loop(double t, int f)
134 evas_textblock_cursor_paragraph_first(cur); 130 evas_textblock_cursor_paragraph_first(cur);
135 else 131 else
136 evas_textblock_cursor_paragraph_next(cur); 132 evas_textblock_cursor_paragraph_next(cur);
137 133fps:
138#endif // XXX
139 FPS_STD(NAME); 134 FPS_STD(NAME);
140} 135}
141 136