summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/ecore_wl2/ecore_wl2_test_window.c129
-rw-r--r--src/tests/edje/edje_test_text.c9
-rw-r--r--src/tests/efl_mono/Eo.cs42
-rw-r--r--src/tests/efl_mono/Inheritance.cs6
-rw-r--r--src/tests/efl_mono/Main.cs6
-rw-r--r--src/tests/efl_mono/Structs.cs44
-rw-r--r--src/tests/efl_mono/eolian_mono_suite.cc61
-rw-r--r--src/tests/efl_mono/meson.build11
-rw-r--r--src/tests/eina/eina_test_matrix.c4
-rw-r--r--src/tests/elementary/efl_ui_suite.c1
-rw-r--r--src/tests/elementary/efl_ui_suite.h1
-rw-r--r--src/tests/elementary/efl_ui_test_layout.c36
-rw-r--r--src/tests/elementary/efl_ui_test_position_manager_common.c1
-rw-r--r--src/tests/elementary/efl_ui_test_select_model.c4
-rw-r--r--src/tests/elementary/efl_ui_test_spotlight.c111
-rw-r--r--src/tests/elementary/efl_ui_test_text.c141
-rw-r--r--src/tests/elementary/elm_test_layout.c17
-rw-r--r--src/tests/elementary/meson.build1
-rw-r--r--src/tests/elementary/spec/efl_test_basics.c5
-rw-r--r--src/tests/elementary/spec/efl_test_multi_selectable.c74
-rw-r--r--src/tests/elocation/elocation_suite.c235
-rw-r--r--src/tests/eo/suite/eo_test_event.c35
-rw-r--r--src/tests/eolian_js/test_object.eo2
-rw-r--r--src/tests/evas/efl_canvas_animation.c51
-rw-r--r--src/tests/evas/evas_test_object.c158
-rw-r--r--src/tests/evas/evas_test_textblock.c448
26 files changed, 1068 insertions, 565 deletions
diff --git a/src/tests/ecore_wl2/ecore_wl2_test_window.c b/src/tests/ecore_wl2/ecore_wl2_test_window.c
index 9c6462c..c392475 100644
--- a/src/tests/ecore_wl2/ecore_wl2_test_window.c
+++ b/src/tests/ecore_wl2/ecore_wl2_test_window.c
@@ -329,6 +329,129 @@ EFL_START_TEST(wl2_window_type)
329} 329}
330EFL_END_TEST 330EFL_END_TEST
331 331
332EFL_START_TEST(wl2_window_activated)
333{
334 Ecore_Wl2_Display *disp;
335 Ecore_Wl2_Window *win;
336 Eina_Bool ret;
337
338 disp = _display_connect();
339 ck_assert(disp != NULL);
340
341 win = _window_create(disp);
342 ck_assert(win != NULL);
343
344 ret = ecore_wl2_window_activated_get(win);
345
346 fail_if(ret != EINA_TRUE);
347}
348EFL_END_TEST
349
350EFL_START_TEST(wl2_window_aspect)
351{
352 Ecore_Wl2_Display *disp;
353 Ecore_Wl2_Window *win;
354 int w, h;
355 unsigned int aspect;
356
357 disp = _display_connect();
358 ck_assert(disp != NULL);
359
360 win = _window_create(disp);
361 ck_assert(win != NULL);
362
363 ecore_wl2_window_aspect_set(win, 1, 1, 3);
364 ecore_wl2_window_aspect_get(win, &w, &h, &aspect);
365
366 fail_if(w != 1);
367 fail_if(h != 1);
368 fail_if(aspect != 3);
369}
370EFL_END_TEST
371
372EFL_START_TEST(wl2_window_title)
373{
374 Ecore_Wl2_Display *disp;
375 Ecore_Wl2_Window *win;
376 const char *title;
377
378 disp = _display_connect();
379 ck_assert(disp != NULL);
380
381 win = _window_create(disp);
382 ck_assert(win != NULL);
383
384 ecore_wl2_window_title_set(win, "TEST");
385 title = ecore_wl2_window_title_get(win);
386
387 fail_if(strcmp(title, "TEST"));
388}
389EFL_END_TEST
390
391EFL_START_TEST(wl2_window_class)
392{
393 Ecore_Wl2_Display *disp;
394 Ecore_Wl2_Window *win;
395 const char *class;
396
397 disp = _display_connect();
398 ck_assert(disp != NULL);
399
400 win = _window_create(disp);
401 ck_assert(win != NULL);
402
403 ecore_wl2_window_class_set(win, "TEST");
404 class = ecore_wl2_window_class_get(win);
405
406 fail_if(strcmp(class, "TEST"));
407}
408EFL_END_TEST
409
410EFL_START_TEST(wl2_window_available_rotation)
411{
412 Ecore_Wl2_Display *disp;
413 Ecore_Wl2_Window *win;
414 Eina_Bool ret;
415 int rots[2] = { 90, 180 };
416 int *ret_rots;
417 unsigned int ret_count;
418
419 disp = _display_connect();
420 ck_assert(disp != NULL);
421
422 win = _window_create(disp);
423 ck_assert(win != NULL);
424
425 ecore_wl2_window_available_rotations_set(win, rots, 2);
426
427 ret = ecore_wl2_window_available_rotations_get(win, &ret_rots, &ret_count);
428
429 fail_if(ret != EINA_TRUE);
430 fail_if(ret_rots[0] != 90);
431 fail_if(ret_rots[1] != 180);
432 fail_if(ret_count != 2);
433}
434EFL_END_TEST
435
436EFL_START_TEST(wl2_window_role)
437{
438 Ecore_Wl2_Display *disp;
439 Ecore_Wl2_Window *win;
440 const char *role;
441
442 disp = _display_connect();
443 ck_assert(disp != NULL);
444
445 win = _window_create(disp);
446 ck_assert(win != NULL);
447
448 ecore_wl2_window_role_set(win, "TEST");
449 role = ecore_wl2_window_role_get(win);
450
451 fail_if(strcmp(role, "TEST"));
452}
453EFL_END_TEST
454
332void 455void
333ecore_wl2_test_window(TCase *tc) 456ecore_wl2_test_window(TCase *tc)
334{ 457{
@@ -352,5 +475,11 @@ ecore_wl2_test_window(TCase *tc)
352 tcase_add_test(tc, wl2_wm_window_rotation_app); 475 tcase_add_test(tc, wl2_wm_window_rotation_app);
353 tcase_add_test(tc, wl2_window_geometry); 476 tcase_add_test(tc, wl2_window_geometry);
354 tcase_add_test(tc, wl2_window_type); 477 tcase_add_test(tc, wl2_window_type);
478 tcase_add_test(tc, wl2_window_activated);
479 tcase_add_test(tc, wl2_window_available_rotation);
480 tcase_add_test(tc, wl2_window_aspect);
481 tcase_add_test(tc, wl2_window_class);
482 tcase_add_test(tc, wl2_window_title);
483 tcase_add_test(tc, wl2_window_role);
355 } 484 }
356} 485}
diff --git a/src/tests/edje/edje_test_text.c b/src/tests/edje/edje_test_text.c
index 45ef800..fc5e67a 100644
--- a/src/tests/edje/edje_test_text.c
+++ b/src/tests/edje/edje_test_text.c
@@ -161,7 +161,8 @@ START_TEST(edje_test_text_font)
161 efl_file_key_set(layout, "test"); 161 efl_file_key_set(layout, "test");
162 ck_assert(!efl_file_load(layout)); 162 ck_assert(!efl_file_load(layout));
163 163
164 efl_text_font_set(efl_part(layout, "text"), "Sans", 14); 164 efl_text_font_family_set(efl_part(layout, "text"), "Sans");
165 efl_text_font_size_set(efl_part(layout, "text"), 14);
165 166
166} 167}
167END_TEST 168END_TEST
@@ -288,7 +289,8 @@ _basic_check(Eo *layout, Eina_Bool set)
288 { 289 {
289 efl_text_wrap_set(efl_part(layout, "text"), EFL_TEXT_FORMAT_WRAP_WORD); 290 efl_text_wrap_set(efl_part(layout, "text"), EFL_TEXT_FORMAT_WRAP_WORD);
290 efl_text_ellipsis_set(efl_part(layout, "text"), 1.0); 291 efl_text_ellipsis_set(efl_part(layout, "text"), 1.0);
291 efl_text_font_set(efl_part(layout, "text"), "Sans", 12); 292 efl_text_font_family_set(efl_part(layout, "text"), "Sans");
293 efl_text_font_size_set(efl_part(layout, "text"), 12);
292 } 294 }
293 295
294 wrap = efl_text_wrap_get(efl_part(layout, "text")); 296 wrap = efl_text_wrap_get(efl_part(layout, "text"));
@@ -297,7 +299,8 @@ _basic_check(Eo *layout, Eina_Bool set)
297 ellipsis = efl_text_ellipsis_get(efl_part(layout, "text")); 299 ellipsis = efl_text_ellipsis_get(efl_part(layout, "text"));
298 ck_assert(EINA_DBL_EQ(ellipsis, 1.0)); 300 ck_assert(EINA_DBL_EQ(ellipsis, 1.0));
299 301
300 efl_text_font_get(efl_part(layout, "text"), &font, &size); 302 font = efl_text_font_family_get(efl_part(layout, "text"));
303 size = efl_text_font_size_get(efl_part(layout, "text"));
301 ck_assert_str_eq(font, "Sans"); 304 ck_assert_str_eq(font, "Sans");
302 ck_assert_int_eq(size, 12); 305 ck_assert_int_eq(size, 12);
303 } 306 }
diff --git a/src/tests/efl_mono/Eo.cs b/src/tests/efl_mono/Eo.cs
index 9a52085..1477429 100644
--- a/src/tests/efl_mono/Eo.cs
+++ b/src/tests/efl_mono/Eo.cs
@@ -515,7 +515,7 @@ class TestProvider
515 private class ProviderHolder : Dummy.TestObject 515 private class ProviderHolder : Dummy.TestObject
516 { 516 {
517 private Dummy.TestObject provider; 517 private Dummy.TestObject provider;
518 public string ProviderName 518 public static string ProviderName
519 { 519 {
520 get 520 get
521 { 521 {
@@ -526,7 +526,7 @@ class TestProvider
526 public ProviderHolder() : base(null) 526 public ProviderHolder() : base(null)
527 { 527 {
528 this.provider = new Dummy.TestObject(this); 528 this.provider = new Dummy.TestObject(this);
529 this.provider.Name = this.ProviderName; 529 this.provider.Name = ProviderHolder.ProviderName;
530 this.provider.IfaceProp = 1997; 530 this.provider.IfaceProp = 1997;
531 } 531 }
532 532
@@ -553,7 +553,7 @@ class TestProvider
553 553
554 provider = obj.CallFindProviderForIface(); 554 provider = obj.CallFindProviderForIface();
555 Test.AssertNotNull(provider, msg : "Provider of ITestIFace must not be null"); 555 Test.AssertNotNull(provider, msg : "Provider of ITestIFace must not be null");
556 Test.AssertEquals(provider.Name, obj.ProviderName, "Provider name does not match expected"); 556 Test.AssertEquals(provider.Name, ProviderHolder.ProviderName, "Provider name does not match expected");
557 obj.Dispose(); 557 obj.Dispose();
558 } 558 }
559} 559}
@@ -675,4 +675,40 @@ class TestHiddenClasses
675 } 675 }
676} 676}
677 677
678class TestAliasEquality
679{
680 static Dummy.MyInt a = 4;
681 static Dummy.MyInt b = 4;
682 static Dummy.MyInt c = 5;
683
684 public static void test_equals()
685 {
686 Test.AssertEquals(a, b);
687 Test.AssertNotEquals(a, c);
688 }
689
690 public static void test_equals_different_types()
691 {
692 Test.Assert(!(a.Equals(new Object())));
693 }
694
695 public static void test_equatable()
696 {
697 Test.Assert(((IEquatable<Dummy.MyInt>)a).Equals(b));
698 Test.Assert(!((IEquatable<Dummy.MyInt>)a).Equals(c));
699 }
700
701 public static void test_equality_operators()
702 {
703 Test.Assert(a == b);
704 Test.Assert(a != c);
705 }
706
707 public static void test_hash_code()
708 {
709 Test.AssertEquals(a.GetHashCode(), b.GetHashCode());
710 Test.AssertNotEquals(a.GetHashCode(), c.GetHashCode());
711 }
712}
713
678} 714}
diff --git a/src/tests/efl_mono/Inheritance.cs b/src/tests/efl_mono/Inheritance.cs
index 1595759..852a639 100644
--- a/src/tests/efl_mono/Inheritance.cs
+++ b/src/tests/efl_mono/Inheritance.cs
@@ -142,9 +142,9 @@ class TestInheritance
142 142
143 CreateAndCheckInheritedObjects(out parentWRef, out childWRef); 143 CreateAndCheckInheritedObjects(out parentWRef, out childWRef);
144 144
145 // Two invocations to iterate a the child wasn't being released with a single one 145 // We need some extra iterations of the main loop to allow the async callbacks
146 Test.CollectAndIterate(); 146 // registered from the Dispose method to the main loop to run.
147 Test.CollectAndIterate(); 147 Test.CollectAndIterate(10, 10);
148 148
149 var parent = (Dummy.TestObject) parentWRef.Target; 149 var parent = (Dummy.TestObject) parentWRef.Target;
150 var child = (Dummy.TestObject) childWRef.Target; 150 var child = (Dummy.TestObject) childWRef.Target;
diff --git a/src/tests/efl_mono/Main.cs b/src/tests/efl_mono/Main.cs
index 7829cf3..5a9f93c 100644
--- a/src/tests/efl_mono/Main.cs
+++ b/src/tests/efl_mono/Main.cs
@@ -24,8 +24,8 @@ class TestMain
24 static Type[] GetTestCases(String name="") 24 static Type[] GetTestCases(String name="")
25 { 25 {
26 return Assembly.GetExecutingAssembly().GetTypes().Where(t => String.Equals(t.Namespace, "TestSuite", StringComparison.Ordinal) && 26 return Assembly.GetExecutingAssembly().GetTypes().Where(t => String.Equals(t.Namespace, "TestSuite", StringComparison.Ordinal) &&
27 t.Name.StartsWith("Test") && 27 t.Name.StartsWith("Test", StringComparison.Ordinal) &&
28 t.Name.Contains(name)).ToArray(); 28 t.Name.Contains(name, StringComparison.Ordinal)).ToArray();
29 } 29 }
30 30
31 static int Main(string[] args) 31 static int Main(string[] args)
@@ -45,7 +45,7 @@ class TestMain
45 String ckRunSuite = Environment.GetEnvironmentVariable("CK_RUN_SUITE"); 45 String ckRunSuite = Environment.GetEnvironmentVariable("CK_RUN_SUITE");
46 String ckRunCase = Environment.GetEnvironmentVariable("CK_RUN_CASE"); 46 String ckRunCase = Environment.GetEnvironmentVariable("CK_RUN_CASE");
47 47
48 if (ckRunSuite != null && !ckRunSuite.Equals("mono")) 48 if (ckRunSuite != null && !ckRunSuite.Equals("mono", StringComparison.Ordinal))
49 return 0; 49 return 0;
50 50
51 if (ckRunCase == null) 51 if (ckRunCase == null)
diff --git a/src/tests/efl_mono/Structs.cs b/src/tests/efl_mono/Structs.cs
index 998610c..60be42e 100644
--- a/src/tests/efl_mono/Structs.cs
+++ b/src/tests/efl_mono/Structs.cs
@@ -377,4 +377,48 @@ internal class TestStructs
377 // } 377 // }
378} 378}
379 379
380internal class TestStructEquality
381{
382 static Dummy.StructSimple a = new Dummy.StructSimple(1, 2, (char)3, 4, Fstring: "", Fmstring: "", Fstringshare: "");
383 static Dummy.StructSimple b = new Dummy.StructSimple(1, 2, (char)3, 4, Fstring: "", Fmstring: "", Fstringshare: "");
384
385 static Dummy.StructSimple c = new Dummy.StructSimple(4, 3, (char)2, 1, Fstring: "", Fmstring: "", Fstringshare: "");
386
387 // to check if we differ on a single struct field
388 static Dummy.StructSimple singleDifferentField = new Dummy.StructSimple(1, 2, (char)3, 5, Fstring: "", Fmstring: "", Fstringshare: "");
389
390 public static void test_equals()
391 {
392 Test.AssertEquals(a, b);
393 Test.AssertNotEquals(a, c);
394 Test.AssertNotEquals(a, singleDifferentField);
395 }
396
397 public static void test_equals_different_types()
398 {
399 Test.Assert(!(a.Equals(new Object())));
400 }
401
402 public static void test_equatable()
403 {
404 Test.Assert(((IEquatable<Dummy.StructSimple>)a).Equals(b));
405 Test.Assert(!((IEquatable<Dummy.StructSimple>)a).Equals(c));
406 Test.Assert(!((IEquatable<Dummy.StructSimple>)a).Equals(singleDifferentField));
407 }
408
409 public static void test_equality_operators()
410 {
411 Test.Assert(a == b);
412 Test.Assert(a != c);
413 Test.Assert(a != singleDifferentField);
414 }
415
416 public static void test_hash_code()
417 {
418 Test.AssertEquals(a.GetHashCode(), b.GetHashCode());
419 Test.AssertNotEquals(a.GetHashCode(), c.GetHashCode());
420 Test.AssertNotEquals(a.GetHashCode(), singleDifferentField.GetHashCode());
421 }
422}
423
380} 424}
diff --git a/src/tests/efl_mono/eolian_mono_suite.cc b/src/tests/efl_mono/eolian_mono_suite.cc
new file mode 100644
index 0000000..b5ee732
--- /dev/null
+++ b/src/tests/efl_mono/eolian_mono_suite.cc
@@ -0,0 +1,61 @@
1/*
2 * Copyright 2019 by its authors. See AUTHORS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifdef HAVE_CONFIG_H
18#include <config.h>
19#endif
20
21#include "../../bin/eolian_mono/eolian/mono/utils.hh"
22
23#include <check.h>
24#include "../efl_check.h"
25
26
27
28EFL_START_TEST(eolian_mono_test_util_ends_with)
29{
30 ck_assert(eolian_mono::utils::ends_with("SomeFlags", "Flags"));
31 ck_assert(eolian_mono::utils::ends_with("Flags", "Flags"));
32 ck_assert(!eolian_mono::utils::ends_with("Flagz", "Flags"));
33 ck_assert(!eolian_mono::utils::ends_with("FlagsSome", "Flags"));
34}
35EFL_END_TEST
36
37void
38eolian_mono_utils_test(TCase* tc)
39{
40 tcase_add_test(tc, eolian_mono_test_util_ends_with);
41}
42
43static const Efl_Test_Case etc[] = {
44 { "Eolian mono utils", eolian_mono_utils_test },
45 { NULL, NULL }
46};
47
48int main(int argc, char *argv[])
49{
50 int failed_count;
51
52 if (!_efl_test_option_disp(argc, argv, etc))
53 return 0;
54
55 putenv(const_cast<char*>("EFL_RUN_IN_TREE=1"));
56
57 failed_count = _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
58 "Eolian C++", etc, NULL, NULL);
59
60 return (failed_count == 0) ? 0 : 255;
61}
diff --git a/src/tests/efl_mono/meson.build b/src/tests/efl_mono/meson.build
index 4ab4cff..695ff07 100644
--- a/src/tests/efl_mono/meson.build
+++ b/src/tests/efl_mono/meson.build
@@ -174,3 +174,14 @@ else
174 env : env_mono 174 env : env_mono
175 ) 175 )
176endif 176endif
177
178eolian_mono_helpers_suite = executable('eolian-mono-suite',
179 ['eolian_mono_suite.cc'],
180 include_directories : config_dir,
181 dependencies: [check, eolian_cxx, eina_cxx],
182 cpp_args : package_c_args + [
183 '-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',
184 '-DTESTS_SRC_DIR="'+meson.current_source_dir()+'"']
185)
186
187test('eolian-mono-suite', eolian_mono_helpers_suite)
diff --git a/src/tests/eina/eina_test_matrix.c b/src/tests/eina/eina_test_matrix.c
index ac3afa8..2fa860c 100644
--- a/src/tests/eina/eina_test_matrix.c
+++ b/src/tests/eina/eina_test_matrix.c
@@ -463,8 +463,8 @@ EFL_START_TEST(eina_matrix3_operations)
463 fail_if (!MATRIX3_CMP(m1.xx, m1.xy, m1.xz, 463 fail_if (!MATRIX3_CMP(m1.xx, m1.xy, m1.xz,
464 m1.yx, m1.yy, m1.yz, 464 m1.yx, m1.yy, m1.yz,
465 m1.zx, m1.zy, m1.zz, 465 m1.zx, m1.zy, m1.zz,
466 cosf(rotate_radian), -sinf(rotate_radian), 0, 466 cos(rotate_radian), -sin(rotate_radian), 0,
467 sinf(rotate_radian), cosf(rotate_radian), 0, 467 sin(rotate_radian), cos(rotate_radian), 0,
468 0, 0, 1)); 468 0, 0, 1));
469 469
470 eina_matrix3_values_set(&m1, 470 eina_matrix3_values_set(&m1,
diff --git a/src/tests/elementary/efl_ui_suite.c b/src/tests/elementary/efl_ui_suite.c
index 13d406d..9234d68 100644
--- a/src/tests/elementary/efl_ui_suite.c
+++ b/src/tests/elementary/efl_ui_suite.c
@@ -41,6 +41,7 @@ static const Efl_Test_Case etc[] = {
41 { "efl_ui_select_model", efl_ui_test_select_model }, 41 { "efl_ui_select_model", efl_ui_test_select_model },
42 { "efl_ui_view_model", efl_ui_test_view_model }, 42 { "efl_ui_view_model", efl_ui_test_view_model },
43 { "efl_ui_group_item", efl_ui_test_group_item }, 43 { "efl_ui_group_item", efl_ui_test_group_item },
44 { "efl_ui_text", efl_ui_test_text},
44 { NULL, NULL } 45 { NULL, NULL }
45}; 46};
46 47
diff --git a/src/tests/elementary/efl_ui_suite.h b/src/tests/elementary/efl_ui_suite.h
index 1456cea..cb83a00 100644
--- a/src/tests/elementary/efl_ui_suite.h
+++ b/src/tests/elementary/efl_ui_suite.h
@@ -52,6 +52,7 @@ void efl_ui_test_scroller(TCase *tc);
52void efl_ui_test_select_model(TCase *tc); 52void efl_ui_test_select_model(TCase *tc);
53void efl_ui_test_view_model(TCase *tc); 53void efl_ui_test_view_model(TCase *tc);
54void efl_ui_test_group_item(TCase *tc); 54void efl_ui_test_group_item(TCase *tc);
55void efl_ui_test_text(TCase *tc);
55 56
56void loop_timer_interval_set(Eo *obj, double in); 57void loop_timer_interval_set(Eo *obj, double in);
57 58
diff --git a/src/tests/elementary/efl_ui_test_layout.c b/src/tests/elementary/efl_ui_test_layout.c
index 5aa64e0..387bf9a 100644
--- a/src/tests/elementary/efl_ui_test_layout.c
+++ b/src/tests/elementary/efl_ui_test_layout.c
@@ -149,19 +149,46 @@ EFL_START_TEST(efl_ui_layout_test_layout_force)
149} 149}
150EFL_END_TEST 150EFL_END_TEST
151 151
152/* private */
153EAPI Eina_Bool elm_widget_theme_klass_set(Evas_Object *obj, const char *name);
154EAPI Eina_Bool elm_widget_theme_style_set(Evas_Object *obj, const char *name);
155
156EFL_START_TEST(efl_ui_layout_test_callback)
157{
158 Evas_Object *win;
159 int called = 0;
160 Eina_Bool klass, style;
161
162 win = win_add(NULL, "layout", EFL_UI_WIN_TYPE_BASIC);
163 efl_add(EFL_UI_LAYOUT_CLASS, win,
164 efl_event_callback_add(efl_added, EFL_UI_LAYOUT_EVENT_THEME_CHANGED, (void*)event_callback_single_call_int_data, &called),
165 klass = elm_widget_theme_klass_set(efl_added, "button"),
166 style = elm_widget_theme_style_set(efl_added, "anchor")
167 );
168 ck_assert_int_eq(klass, 1);
169 ck_assert_int_eq(style, 1);
170 ck_assert_int_eq(called, 1);
171}
172EFL_END_TEST
173
152EFL_START_TEST(efl_ui_layout_test_layout_theme) 174EFL_START_TEST(efl_ui_layout_test_layout_theme)
153{ 175{
154 Evas_Object *win; 176 Evas_Object *win;
155 const char *klass, *group, *style; 177 const char *klass, *group, *style;
178 Eina_Error err;
179 int called = 0;
156 180
157 win = win_add(NULL, "layout", EFL_UI_WIN_TYPE_BASIC); 181 win = win_add(NULL, "layout", EFL_UI_WIN_TYPE_BASIC);
158 Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, win, 182 Eo *layout = efl_add(EFL_UI_LAYOUT_CLASS, win,
159 efl_ui_layout_theme_set(efl_added, "win", "background", NULL) 183 efl_event_callback_add(efl_added, EFL_UI_LAYOUT_EVENT_THEME_CHANGED, (void*)event_callback_single_call_int_data, &called),
184 err = efl_ui_layout_theme_set(efl_added, "button", NULL, "anchor")
160 ); 185 );
186 ck_assert_int_eq(err, 0);
161 efl_ui_layout_theme_get(layout, &klass, &group, &style); 187 efl_ui_layout_theme_get(layout, &klass, &group, &style);
162 ck_assert_str_eq(klass, "win"); 188 ck_assert_str_eq(klass, "button");
163 ck_assert_str_eq(group, "background"); 189 ck_assert(!group);
164 ck_assert(!style); 190 ck_assert_str_eq(style, "anchor");
191 ck_assert_int_eq(called, 1);
165} 192}
166EFL_END_TEST 193EFL_END_TEST
167 194
@@ -189,5 +216,6 @@ void efl_ui_test_layout(TCase *tc)
189 tcase_add_test(tc, efl_ui_layout_test_layout_force); 216 tcase_add_test(tc, efl_ui_layout_test_layout_force);
190 tcase_add_test(tc, efl_ui_layout_test_layout_theme); 217 tcase_add_test(tc, efl_ui_layout_test_layout_theme);
191 tcase_add_test(tc, efl_ui_layout_test_api_ordering); 218 tcase_add_test(tc, efl_ui_layout_test_api_ordering);
219 tcase_add_test(tc, efl_ui_layout_test_callback);
192 tcase_add_test(tc, efl_ui_layout_test_property_bind_provider); 220 tcase_add_test(tc, efl_ui_layout_test_property_bind_provider);
193} 221}
diff --git a/src/tests/elementary/efl_ui_test_position_manager_common.c b/src/tests/elementary/efl_ui_test_position_manager_common.c
index 63e31d4..ea73d01 100644
--- a/src/tests/elementary/efl_ui_test_position_manager_common.c
+++ b/src/tests/elementary/efl_ui_test_position_manager_common.c
@@ -71,6 +71,7 @@ _initial_setup(void)
71 arr_size = eina_inarray_new(sizeof(Eina_Size2D), 10); 71 arr_size = eina_inarray_new(sizeof(Eina_Size2D), 10);
72 72
73 efl_ui_position_manager_data_access_v1_data_access_set(position_manager, 73 efl_ui_position_manager_data_access_v1_data_access_set(position_manager,
74 win,
74 NULL, _obj_accessor_get_at, NULL, 75 NULL, _obj_accessor_get_at, NULL,
75 NULL, _size_accessor_get_at, NULL, 76 NULL, _size_accessor_get_at, NULL,
76 0); 77 0);
diff --git a/src/tests/elementary/efl_ui_test_select_model.c b/src/tests/elementary/efl_ui_test_select_model.c
index e2b61c5..63f5340 100644
--- a/src/tests/elementary/efl_ui_test_select_model.c
+++ b/src/tests/elementary/efl_ui_test_select_model.c
@@ -111,12 +111,12 @@ EFL_START_TEST(efl_test_select_model)
111 111
112 ecore_main_loop_begin(); 112 ecore_main_loop_begin();
113 113
114 it = efl_ui_multi_selectable_async_selected_iterator_new(model); 114 it = efl_ui_multi_selectable_selected_ndx_iterator_new(model);
115 EINA_ITERATOR_FOREACH(it, index) 115 EINA_ITERATOR_FOREACH(it, index)
116 fail_if(*index != 2); 116 fail_if(*index != 2);
117 eina_iterator_free(it); 117 eina_iterator_free(it);
118 118
119 it = efl_ui_multi_selectable_async_unselected_iterator_new(model); 119 it = efl_ui_multi_selectable_unselected_ndx_iterator_new(model);
120 EINA_ITERATOR_FOREACH(it, index) 120 EINA_ITERATOR_FOREACH(it, index)
121 fail_if(*index == 2); 121 fail_if(*index == 2);
122 eina_iterator_free(it); 122 eina_iterator_free(it);
diff --git a/src/tests/elementary/efl_ui_test_spotlight.c b/src/tests/elementary/efl_ui_test_spotlight.c
index c093efb..9d5f433 100644
--- a/src/tests/elementary/efl_ui_test_spotlight.c
+++ b/src/tests/elementary/efl_ui_test_spotlight.c
@@ -116,6 +116,7 @@ typedef struct {
116 } spotlight; 116 } spotlight;
117 struct { 117 struct {
118 int called; 118 int called;
119 Eina_Bool value;
119 } animation; 120 } animation;
120 double last_position; 121 double last_position;
121} Transition_Calls; 122} Transition_Calls;
@@ -187,7 +188,7 @@ static void
187_transition_animation_set(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Eina_Bool animation) 188_transition_animation_set(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Eina_Bool animation)
188{ 189{
189 transition_calls.animation.called++; 190 transition_calls.animation.called++;
190 ck_assert_int_eq(animation, EINA_TRUE); 191 transition_calls.animation.value = animation;
191} 192}
192 193
193static Eina_Bool 194static Eina_Bool
@@ -197,8 +198,8 @@ _transition_animation_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
197} 198}
198 199
199EFL_OPS_DEFINE(transition_tracker, 200EFL_OPS_DEFINE(transition_tracker,
200 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_animation_enabled_set, _transition_animation_set), 201 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_animated_transition_set, _transition_animation_set),
201 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_animation_enabled_get, _transition_animation_get), 202 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_animated_transition_get, _transition_animation_get),
202 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_content_add, _transition_content_add), 203 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_content_add, _transition_content_add),
203 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_content_del, _transition_content_del), 204 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_content_del, _transition_content_del),
204 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_switch_to, _transition_request_switch), 205 EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_switch_to, _transition_request_switch),
@@ -254,18 +255,18 @@ EFL_START_TEST (efl_ui_spotlight_active_index)
254} 255}
255EFL_END_TEST 256EFL_END_TEST
256 257
257EFL_START_TEST (efl_ui_smart_transition_calls) 258static void
259_verify_transition_calls(int number_of_animation_calls, Eina_Bool animation_value)
258{ 260{
259 Efl_Ui_Widget *w, *w1, *w2; 261 Efl_Ui_Widget *w, *w1, *w2;
260 Efl_Ui_Spotlight_Manager*t = _create_transition();
261 262
262 w = efl_add(WIDGET_CLASS, win); 263 w = efl_add(WIDGET_CLASS, win);
263 w1 = efl_add(WIDGET_CLASS, win); 264 w1 = efl_add(WIDGET_CLASS, win);
264 w2 = efl_add(WIDGET_CLASS, win); 265 w2 = efl_add(WIDGET_CLASS, win);
265 266
266 efl_ui_spotlight_manager_set(container, t);
267 transition_calls.last_position = -2.0; 267 transition_calls.last_position = -2.0;
268 ck_assert_int_eq(transition_calls.animation.called, 1); 268 ck_assert_int_eq(transition_calls.animation.called, number_of_animation_calls);
269 ck_assert_int_eq(transition_calls.animation.value, animation_value);
269 ck_assert_int_eq(transition_calls.spotlight.called, 1); 270 ck_assert_int_eq(transition_calls.spotlight.called, 1);
270 ck_assert_ptr_eq(transition_calls.spotlight.spotlight, container); 271 ck_assert_ptr_eq(transition_calls.spotlight.spotlight, container);
271 //We cannot verify group 272 //We cannot verify group
@@ -343,6 +344,24 @@ EFL_START_TEST (efl_ui_smart_transition_calls)
343 ck_assert_ptr_eq(transition_calls.content_del.current_page_at_call, w2); 344 ck_assert_ptr_eq(transition_calls.content_del.current_page_at_call, w2);
344 transition_calls.content_del.called = 0; 345 transition_calls.content_del.called = 0;
345} 346}
347
348EFL_START_TEST (efl_ui_smart_transition_calls)
349{
350 Efl_Ui_Spotlight_Manager*t = _create_transition();
351 efl_ui_spotlight_manager_set(container, t);
352
353 _verify_transition_calls(2, EINA_TRUE);
354}
355EFL_END_TEST
356
357EFL_START_TEST (efl_ui_smart_transition_calls_no_animation)
358{
359 Efl_Ui_Spotlight_Manager*t = _create_transition();
360 efl_ui_spotlight_manager_set(container, t);
361 efl_ui_spotlight_animated_transition_set(container, EINA_FALSE);
362
363 _verify_transition_calls(3, EINA_FALSE);
364}
346EFL_END_TEST 365EFL_END_TEST
347 366
348 367
@@ -521,8 +540,8 @@ EFL_START_TEST (efl_ui_spotlight_test_push1)
521 } 540 }
522 Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win); 541 Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
523 efl_ui_spotlight_push(container, w); 542 efl_ui_spotlight_push(container, w);
524 ck_assert_int_eq(efl_pack_index_get(container, w), 0); 543 ck_assert_int_eq(efl_pack_index_get(container, w), 1);
525 ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), efl_pack_content_get(container, 0)); 544 ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), efl_pack_content_get(container, 1));
526} 545}
527EFL_END_TEST 546EFL_END_TEST
528 547
@@ -537,7 +556,7 @@ EFL_START_TEST (efl_ui_spotlight_test_push2)
537 } 556 }
538 Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win); 557 Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
539 efl_ui_spotlight_push(container, w); 558 efl_ui_spotlight_push(container, w);
540 ck_assert_int_eq(efl_pack_index_get(container, w), 3); 559 ck_assert_int_eq(efl_pack_index_get(container, w), 4);
541 ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w); 560 ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
542} 561}
543EFL_END_TEST 562EFL_END_TEST
@@ -618,6 +637,75 @@ EFL_START_TEST (efl_ui_spotlight_test_pop3)
618} 637}
619EFL_END_TEST 638EFL_END_TEST
620 639
640EFL_START_TEST (efl_ui_spotlight_animated_transition)
641{
642 //this checks animation handing with the plain manager, there is no animation that will be played, but the flag should be preserved
643 ck_assert_int_eq(efl_ui_spotlight_animated_transition_get(container), EINA_TRUE);
644 efl_ui_spotlight_animated_transition_set(container, EINA_FALSE);
645 ck_assert_int_eq(efl_ui_spotlight_manager_animated_transition_get(efl_ui_spotlight_manager_get(container)), EINA_FALSE);
646
647 //now check with a real spotlight manager
648 efl_ui_spotlight_manager_set(container, efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS));
649 efl_ui_spotlight_animated_transition_set(container, EINA_TRUE);
650 ck_assert_int_eq(efl_ui_spotlight_animated_transition_get(container), EINA_TRUE);
651 ck_assert_int_eq(efl_ui_spotlight_manager_animated_transition_get(efl_ui_spotlight_manager_get(container)), EINA_TRUE);
652
653 efl_ui_spotlight_animated_transition_set(container, EINA_FALSE);
654 ck_assert_int_eq(efl_ui_spotlight_animated_transition_get(container), EINA_FALSE);
655 ck_assert_int_eq(efl_ui_spotlight_manager_animated_transition_get(efl_ui_spotlight_manager_get(container)), EINA_FALSE);
656
657 Eo *manager2 = efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS);
658 Eina_Bool animated_transition_manager;
659 efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, win,
660 efl_ui_spotlight_manager_set(efl_added, manager2),
661 efl_ui_spotlight_animated_transition_set(efl_added, EINA_TRUE),
662 animated_transition_manager = efl_ui_spotlight_manager_animated_transition_get(manager2));
663 ck_assert_int_eq(animated_transition_manager, EINA_FALSE);
664 ck_assert_int_eq(efl_ui_spotlight_manager_animated_transition_get(manager2), EINA_TRUE);
665}
666EFL_END_TEST
667
668EFL_START_TEST (efl_ui_spotlight_min_max_sizing)
669{
670 Efl_Ui_Button *btn0, *btn1;
671 Eina_Size2D min, size;
672
673 btn0 = efl_add(WIDGET_CLASS, container);
674 efl_gfx_hint_size_min_set(btn0, EINA_SIZE2D(20, 200));
675
676 btn1 = efl_add(WIDGET_CLASS, container);
677 efl_gfx_hint_size_min_set(btn1, EINA_SIZE2D(200, 20));
678
679 efl_pack_end(container, btn0);
680 efl_pack_end(container, btn1);
681 min = efl_gfx_hint_size_restricted_min_get(container);
682 ck_assert_int_eq(min.w, 200);
683 ck_assert_int_eq(min.h, 200);
684
685 efl_gfx_hint_size_min_set(btn0, EINA_SIZE2D(20, 300));
686 efl_canvas_group_calculate(container);
687
688 min = efl_gfx_hint_size_restricted_min_get(container);
689 ck_assert_int_eq(min.w, 200);
690 ck_assert_int_eq(min.h, 300);
691
692 efl_gfx_hint_size_min_set(btn0, EINA_SIZE2D(20, 20));
693 efl_canvas_group_calculate(container);
694
695 min = efl_gfx_hint_size_restricted_min_get(container);
696 ck_assert_int_eq(min.w, 200);
697 ck_assert_int_eq(min.h, 20);
698
699 efl_ui_spotlight_size_set(container, EINA_SIZE2D(2000, 2000));
700
701 efl_gfx_entity_size_set(container, EINA_SIZE2D(200, 200));
702 size = efl_gfx_entity_size_get(btn0);
703 ck_assert_int_eq(size.w, 200);
704 ck_assert_int_eq(size.h, 200);
705
706}
707EFL_END_TEST
708
621static void 709static void
622spotlight_setup() 710spotlight_setup()
623{ 711{
@@ -644,6 +732,7 @@ void efl_ui_test_spotlight(TCase *tc)
644 tcase_add_test(tc, efl_ui_spotlight_init); 732 tcase_add_test(tc, efl_ui_spotlight_init);
645 tcase_add_test(tc, efl_ui_spotlight_active_index); 733 tcase_add_test(tc, efl_ui_spotlight_active_index);
646 tcase_add_test(tc, efl_ui_smart_transition_calls); 734 tcase_add_test(tc, efl_ui_smart_transition_calls);
735 tcase_add_test(tc, efl_ui_smart_transition_calls_no_animation);
647 tcase_add_test(tc, efl_ui_smart_transition_lifetime); 736 tcase_add_test(tc, efl_ui_smart_transition_lifetime);
648 tcase_add_test(tc, efl_ui_smart_indicator_calls); 737 tcase_add_test(tc, efl_ui_smart_indicator_calls);
649 tcase_add_test(tc, efl_ui_smart_indicator_transition_calls); 738 tcase_add_test(tc, efl_ui_smart_indicator_transition_calls);
@@ -653,4 +742,6 @@ void efl_ui_test_spotlight(TCase *tc)
653 tcase_add_test(tc, efl_ui_spotlight_test_pop1); 742 tcase_add_test(tc, efl_ui_spotlight_test_pop1);
654 tcase_add_test(tc, efl_ui_spotlight_test_pop2); 743 tcase_add_test(tc, efl_ui_spotlight_test_pop2);
655 tcase_add_test(tc, efl_ui_spotlight_test_pop3); 744 tcase_add_test(tc, efl_ui_spotlight_test_pop3);
745 tcase_add_test(tc, efl_ui_spotlight_animated_transition);
746 tcase_add_test(tc, efl_ui_spotlight_min_max_sizing);
656} 747}
diff --git a/src/tests/elementary/efl_ui_test_text.c b/src/tests/elementary/efl_ui_test_text.c
new file mode 100644
index 0000000..b0eecd1
--- /dev/null
+++ b/src/tests/elementary/efl_ui_test_text.c
@@ -0,0 +1,141 @@
1#define EFL_NOLEGACY_API_SUPPORT
2#ifdef HAVE_CONFIG_H
3# include "elementary_config.h"
4#endif
5#define EFL_LAYOUT_CALC_PROTECTED
6#include <Efl_Ui.h>
7#include "efl_ui_suite.h"
8
9static void
10increment_int_changed(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
11{
12 int *value = data;
13 (*value)++;
14}
15
16EFL_START_TEST(text_cnp)
17{
18 Eo *txt;
19 Eo *win = win_add();
20
21 int i_copy = 0, i_paste = 0, i_cut = 0;
22
23 txt = efl_add(EFL_UI_TEXTBOX_CLASS, win,
24 efl_event_callback_add(efl_added, EFL_UI_TEXTBOX_EVENT_SELECTION_COPY, increment_int_changed, &i_copy),
25 efl_event_callback_add(efl_added, EFL_UI_TEXTBOX_EVENT_SELECTION_PASTE, increment_int_changed, &i_paste),
26 efl_event_callback_add(efl_added, EFL_UI_TEXTBOX_EVENT_SELECTION_CUT, increment_int_changed, &i_cut)
27 );
28
29 efl_text_set(txt, "Hello");
30 efl_text_interactive_all_select(txt);
31 efl_ui_textbox_selection_copy(txt);
32 efl_text_interactive_all_select(txt);
33 efl_ui_textbox_selection_cut(txt);
34 efl_ui_textbox_selection_paste(txt);
35 efl_ui_textbox_selection_paste(txt);
36 ecore_main_loop_iterate();
37 ck_assert_int_eq(i_copy, 1);
38 ck_assert_int_eq(i_cut, 1);
39 ck_assert_int_eq(i_paste, 2);
40 //FIXME
41 //fail_if(strcmp(efl_text_get(txt),"HelloHello"));
42 efl_del(txt);
43}
44EFL_END_TEST
45
46EFL_START_TEST(text_all_select_all_unselect)
47{
48 Eo *txt;
49 Eo *win = win_add();
50
51 int i_have_selection = 0, i_selection = 0;
52
53 txt = efl_add(EFL_UI_TEXTBOX_CLASS, win,
54 efl_event_callback_add(efl_added, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED,
55 increment_int_changed, &i_have_selection),
56 efl_event_callback_add(efl_added, EFL_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED,
57 increment_int_changed, &i_selection)
58 );
59
60 efl_text_set(txt, "Hello");
61 efl_text_interactive_all_select(txt);
62 Efl_Text_Cursor *c1=NULL, *c2 =NULL;
63 efl_text_interactive_selection_cursors_get(txt, &c1, &c2);
64 ck_assert_ptr_ne(c1, NULL);
65 ck_assert_ptr_ne(c2, NULL);
66 fail_if(!efl_text_interactive_have_selection_get(txt));
67 ck_assert_int_eq(efl_text_cursor_position_get(c1), 0);
68 ck_assert_int_eq(efl_text_cursor_position_get(c2), 5);
69 efl_text_interactive_all_unselect(txt);
70 fail_if(efl_text_interactive_have_selection_get(txt));
71 ecore_main_loop_iterate();
72 ck_assert_int_eq(i_have_selection, 2);
73 ck_assert_int_eq(i_selection, 1);
74 efl_del(txt);
75 efl_del(win);
76}
77EFL_END_TEST
78
79EFL_START_TEST(text_selection)
80{
81 Eo *txt;
82 Eo *win = win_add();
83
84 txt = efl_add(EFL_UI_TEXTBOX_CLASS, win);
85 efl_gfx_entity_size_set(txt, EINA_SIZE2D(300, 300));
86 efl_text_set(txt, "Hello");
87 get_me_to_those_events(txt);
88 drag_object(txt, 2, 2, 295, 295, EINA_TRUE);
89 ecore_main_loop_iterate();
90 Efl_Text_Cursor *c1=NULL, *c2 =NULL;
91 efl_text_interactive_selection_cursors_get(txt, &c1, &c2);
92 ck_assert_ptr_ne(c1, NULL);
93 ck_assert_ptr_ne(c2, NULL);
94 fail_if(!efl_text_interactive_have_selection_get(txt));
95 ck_assert_int_eq(efl_text_cursor_position_get(c1), 0);
96 ck_assert_int_eq(efl_text_cursor_position_get(c2), 5);
97 efl_text_interactive_all_unselect(txt);
98 fail_if(efl_text_interactive_have_selection_get(txt));
99 efl_text_interactive_selection_allowed_set(txt, EINA_FALSE);
100 drag_object(txt, 2, 2, 295, 295, EINA_TRUE);
101 ecore_main_loop_iterate();
102 fail_if(efl_text_interactive_have_selection_get(txt));
103 efl_del(txt);
104}
105EFL_END_TEST
106
107static void
108user_changed(void *data, const Efl_Event *ev)
109{
110 Efl_Text_Change_Info *info = (Efl_Text_Change_Info *)ev->info;
111 Efl_Text_Change_Info *stored = (Efl_Text_Change_Info *)data;
112 *stored = *info;
113}
114
115EFL_START_TEST(text_user_change)
116{
117 Eo *txt;
118 Eo *win = win_add();
119 Efl_Text_Change_Info info = {0};
120 txt = efl_add(EFL_UI_TEXTBOX_CLASS, win,
121 efl_event_callback_add(efl_added, EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER, user_changed, &info)
122 );
123
124 efl_text_set(txt, "Hello");
125 efl_gfx_entity_size_set(txt, EINA_SIZE2D(300, 300));
126 efl_text_interactive_all_select(txt);
127 efl_ui_textbox_selection_cut(txt);
128 ck_assert_int_eq(info.position, 0);
129 ck_assert_int_eq(info.length, 5);
130 efl_del(txt);
131 efl_del(win);
132}
133EFL_END_TEST
134
135void efl_ui_test_text(TCase *tc)
136{
137 tcase_add_test(tc, text_cnp);
138 tcase_add_test(tc, text_all_select_all_unselect);
139 tcase_add_test(tc, text_selection);
140 tcase_add_test(tc, text_user_change);
141}
diff --git a/src/tests/elementary/elm_test_layout.c b/src/tests/elementary/elm_test_layout.c
index 7ddffc9..d08b9cb 100644
--- a/src/tests/elementary/elm_test_layout.c
+++ b/src/tests/elementary/elm_test_layout.c
@@ -114,10 +114,27 @@ EFL_START_TEST(elm_layout_test_sizing)
114} 114}
115EFL_END_TEST 115EFL_END_TEST
116 116
117EFL_START_TEST(elm_layout_test_theme_changed_callback)
118{
119 Evas_Object *win, *ly;
120 int called = 0;
121
122 win = win_add(NULL, "layout", ELM_WIN_BASIC);
123 evas_object_show(win);
124
125 ly = elm_button_add(win);
126 evas_object_smart_callback_add(ly, "theme,changed", event_callback_single_call_int_data, &called);
127 evas_object_show(ly);
128 elm_object_style_set(ly, "anchor");
129 ck_assert_int_eq(called, 1);
130}
131EFL_END_TEST
132
117void elm_test_layout(TCase *tc) 133void elm_test_layout(TCase *tc)
118{ 134{
119 tcase_add_test(tc, elm_layout_test_legacy_type_check); 135 tcase_add_test(tc, elm_layout_test_legacy_type_check);
120 tcase_add_test(tc, elm_atspi_role_get); 136 tcase_add_test(tc, elm_atspi_role_get);
121 tcase_add_test(tc, elm_layout_test_swallows); 137 tcase_add_test(tc, elm_layout_test_swallows);
122 tcase_add_test(tc, elm_layout_test_sizing); 138 tcase_add_test(tc, elm_layout_test_sizing);
139 tcase_add_test(tc, elm_layout_test_theme_changed_callback);
123} 140}
diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build
index c52a18c..7c7c62f 100644
--- a/src/tests/elementary/meson.build
+++ b/src/tests/elementary/meson.build
@@ -158,6 +158,7 @@ efl_ui_suite_src = [
158 'efl_ui_test_select_model.c', 158 'efl_ui_test_select_model.c',
159 'efl_ui_test_view_model.c', 159 'efl_ui_test_view_model.c',
160 'efl_ui_test_group_item.c', 160 'efl_ui_test_group_item.c',
161 'efl_ui_test_text.c',
161] 162]
162 163
163efl_ui_suite = executable('efl_ui_suite', 164efl_ui_suite = executable('efl_ui_suite',
diff --git a/src/tests/elementary/spec/efl_test_basics.c b/src/tests/elementary/spec/efl_test_basics.c
index 1db6a17..0985adb 100644
--- a/src/tests/elementary/spec/efl_test_basics.c
+++ b/src/tests/elementary/spec/efl_test_basics.c
@@ -17,6 +17,7 @@
17 "Efl.Ui.List_View", 17 "Efl.Ui.List_View",
18 "Efl.Ui.Tab_Bar", 18 "Efl.Ui.Tab_Bar",
19 "Efl.Ui.Tags", 19 "Efl.Ui.Tags",
20 "Efl.Ui.Textbox",
20 "Efl.Ui.Panel", 21 "Efl.Ui.Panel",
21 "Efl.Ui.Scroller", 22 "Efl.Ui.Scroller",
22 "Efl.Ui.Slider", 23 "Efl.Ui.Slider",
@@ -46,7 +47,9 @@
46 "Efl.Ui.Relative_Container", 47 "Efl.Ui.Relative_Container",
47 "Efl.Ui.Animation_View", 48 "Efl.Ui.Animation_View",
48 "Efl.Ui.Table", 49 "Efl.Ui.Table",
49 "Efl.Ui.Flip" 50 "Efl.Ui.Flip",
51 "Efl.Ui.Stack",
52 "Efl.Ui.Pager"
50 ], 53 ],
51 "custom-mapping" : { 54 "custom-mapping" : {
52 "Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS", 55 "Efl.Ui.Grid" : "EFL_UI_GRID_DEFAULT_ITEM_CLASS",
diff --git a/src/tests/elementary/spec/efl_test_multi_selectable.c b/src/tests/elementary/spec/efl_test_multi_selectable.c
index bb01647..3a02ed9 100644
--- a/src/tests/elementary/spec/efl_test_multi_selectable.c
+++ b/src/tests/elementary/spec/efl_test_multi_selectable.c
@@ -36,7 +36,7 @@ EFL_START_TEST(test_multi_select)
36 int c = 0; 36 int c = 0;
37 37
38 Eina_Array *arr_selected; 38 Eina_Array *arr_selected;
39 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 39 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
40 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); 40 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c);
41 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); 41 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL);
42 42
@@ -52,7 +52,7 @@ EFL_START_TEST(test_multi_select)
52 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_TRUE); 52 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_TRUE);
53 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_TRUE); 53 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_TRUE);
54 ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), efl_pack_content_get(widget, 2)); 54 ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), efl_pack_content_get(widget, 2));
55 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 55 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
56 ck_assert_int_eq(eina_array_count(arr_selected), 2); 56 ck_assert_int_eq(eina_array_count(arr_selected), 2);
57 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); 57 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0));
58 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2)); 58 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2));
@@ -70,7 +70,7 @@ EFL_START_TEST(test_multi_select_removal)
70{ 70{
71 int c = 0; 71 int c = 0;
72 Eina_Array *arr_selected; 72 Eina_Array *arr_selected;
73 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 73 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
74 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); 74 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c);
75 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); 75 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL);
76 76
@@ -88,7 +88,7 @@ EFL_START_TEST(test_multi_select_removal)
88 c = 0; 88 c = 0;
89 89
90 ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), NULL); 90 ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), NULL);
91 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 91 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
92 ck_assert_int_eq(eina_array_count(arr_selected), 0); 92 ck_assert_int_eq(eina_array_count(arr_selected), 0);
93 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); 93 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c);
94 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); 94 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL);
@@ -101,7 +101,7 @@ EFL_START_TEST(test_single_select)
101 int c = 0; 101 int c = 0;
102 Eina_Array *arr_selected; 102 Eina_Array *arr_selected;
103 103
104 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE); 104 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE);
105 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); 105 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c);
106 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); 106 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL);
107 107
@@ -116,7 +116,7 @@ EFL_START_TEST(test_single_select)
116 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE); 116 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE);
117 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_TRUE); 117 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_TRUE);
118 ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), efl_pack_content_get(widget, 2)); 118 ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), efl_pack_content_get(widget, 2));
119 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 119 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
120 ck_assert_int_eq(eina_array_count(arr_selected), 1); 120 ck_assert_int_eq(eina_array_count(arr_selected), 1);
121 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 2)); 121 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 2));
122 122
@@ -134,7 +134,7 @@ EFL_START_TEST(test_none_select)
134 Eina_Array *arr_selected; 134 Eina_Array *arr_selected;
135 int c = 0; 135 int c = 0;
136 136
137 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE); 137 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE);
138 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); 138 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c);
139 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); 139 efl_event_callback_add(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL);
140 140
@@ -147,7 +147,7 @@ EFL_START_TEST(test_none_select)
147 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE); 147 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE);
148 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_FALSE); 148 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 2)), EINA_FALSE);
149 ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), NULL); 149 ck_assert_ptr_eq(efl_ui_selectable_last_selected_get(widget), NULL);
150 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 150 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
151 ck_assert_int_eq(eina_array_count(arr_selected), 0); 151 ck_assert_int_eq(eina_array_count(arr_selected), 0);
152 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c); 152 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, (void*) event_callback_single_call_int_data, &c);
153 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL); 153 efl_event_callback_del(widget, EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, event_callback_that_quits_the_main_loop_when_called, NULL);
@@ -159,9 +159,9 @@ EFL_START_TEST(all_select_api)
159{ 159{
160 Eina_Array *arr_selected; 160 Eina_Array *arr_selected;
161 161
162 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 162 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
163 efl_ui_selectable_all_select(widget); 163 efl_ui_multi_selectable_all_select(widget);
164 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 164 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
165 165
166 ck_assert_int_eq(eina_array_count(arr_selected), 3); 166 ck_assert_int_eq(eina_array_count(arr_selected), 3);
167 167
@@ -176,11 +176,11 @@ EFL_START_TEST(all_unselect_api)
176{ 176{
177 Eina_Array *arr_selected; 177 Eina_Array *arr_selected;
178 178
179 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 179 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
180 efl_ui_selectable_selected_set(efl_pack_content_get(widget, 0), EINA_TRUE); 180 efl_ui_selectable_selected_set(efl_pack_content_get(widget, 0), EINA_TRUE);
181 181
182 efl_ui_selectable_all_unselect(widget); 182 efl_ui_multi_selectable_all_unselect(widget);
183 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 183 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
184 184
185 ck_assert_int_eq(eina_array_count(arr_selected), 0); 185 ck_assert_int_eq(eina_array_count(arr_selected), 0);
186 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE); 186 ck_assert_int_eq(efl_ui_selectable_selected_get(efl_pack_content_get(widget, 0)), EINA_FALSE);
@@ -192,11 +192,11 @@ EFL_START_TEST(range_unselect)
192{ 192{
193 Eina_Array *arr_selected; 193 Eina_Array *arr_selected;
194 194
195 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 195 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
196 efl_ui_selectable_all_select(widget); 196 efl_ui_multi_selectable_all_select(widget);
197 197
198 efl_ui_selectable_range_unselect(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); 198 efl_ui_multi_selectable_range_unselect(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2));
199 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 199 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
200 ck_assert_int_eq(eina_array_count(arr_selected), 1); 200 ck_assert_int_eq(eina_array_count(arr_selected), 1);
201 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); 201 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0));
202 eina_array_free(arr_selected); 202 eina_array_free(arr_selected);
@@ -207,11 +207,11 @@ EFL_START_TEST(range_unselect2)
207{ 207{
208 Eina_Array *arr_selected; 208 Eina_Array *arr_selected;
209 209
210 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 210 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
211 efl_ui_selectable_all_select(widget); 211 efl_ui_multi_selectable_all_select(widget);
212 212
213 efl_ui_selectable_range_unselect(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); 213 efl_ui_multi_selectable_range_unselect(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1));
214 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 214 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
215 ck_assert_int_eq(eina_array_count(arr_selected), 1); 215 ck_assert_int_eq(eina_array_count(arr_selected), 1);
216 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0)); 216 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 0));
217 eina_array_free(arr_selected); 217 eina_array_free(arr_selected);
@@ -222,9 +222,9 @@ EFL_START_TEST(range_select)
222{ 222{
223 Eina_Array *arr_selected; 223 Eina_Array *arr_selected;
224 224
225 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 225 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
226 efl_ui_selectable_range_select(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2)); 226 efl_ui_multi_selectable_range_select(widget, efl_pack_content_get(widget, 1), efl_pack_content_get(widget, 2));
227 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 227 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
228 ck_assert_int_eq(eina_array_count(arr_selected), 2); 228 ck_assert_int_eq(eina_array_count(arr_selected), 2);
229 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 1)); 229 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 1));
230 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2)); 230 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2));
@@ -236,9 +236,9 @@ EFL_START_TEST(range_select2)
236{ 236{
237 Eina_Array *arr_selected; 237 Eina_Array *arr_selected;
238 238
239 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 239 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
240 efl_ui_selectable_range_select(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1)); 240 efl_ui_multi_selectable_range_select(widget, efl_pack_content_get(widget, 2), efl_pack_content_get(widget, 1));
241 _iterator_to_array(&arr_selected, efl_ui_selectable_selected_iterator_new(widget)); 241 _iterator_to_array(&arr_selected, efl_ui_multi_selectable_selected_iterator_new(widget));
242 ck_assert_int_eq(eina_array_count(arr_selected), 2); 242 ck_assert_int_eq(eina_array_count(arr_selected), 2);
243 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 1)); 243 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 0), efl_pack_content_get(widget, 1));
244 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2)); 244 ck_assert_ptr_eq(eina_array_data_get(arr_selected, 1), efl_pack_content_get(widget, 2));
@@ -250,9 +250,9 @@ EFL_START_TEST(change_mode_from_multi_to_single)
250{ 250{
251 int sel = 0; 251 int sel = 0;
252 252
253 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 253 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
254 efl_ui_selectable_all_select(widget); 254 efl_ui_multi_selectable_all_select(widget);
255 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE); 255 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE);
256 for (int i = 0; i < efl_content_count(widget); ++i) 256 for (int i = 0; i < efl_content_count(widget); ++i)
257 { 257 {
258 if (efl_ui_selectable_selected_get(efl_pack_content_get(widget, i))) 258 if (efl_ui_selectable_selected_get(efl_pack_content_get(widget, i)))
@@ -267,9 +267,9 @@ EFL_START_TEST(change_mode_from_multi_to_none)
267{ 267{
268 int sel = 0; 268 int sel = 0;
269 269
270 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI); 270 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_MULTI);
271 efl_ui_selectable_all_select(widget); 271 efl_ui_multi_selectable_all_select(widget);
272 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE); 272 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE);
273 for (int i = 0; i < efl_content_count(widget); ++i) 273 for (int i = 0; i < efl_content_count(widget); ++i)
274 { 274 {
275 if (efl_ui_selectable_selected_get(efl_pack_content_get(widget, i))) 275 if (efl_ui_selectable_selected_get(efl_pack_content_get(widget, i)))
@@ -283,9 +283,9 @@ EFL_START_TEST(change_mode_from_single_to_none)
283{ 283{
284 int sel = 0; 284 int sel = 0;
285 285
286 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE); 286 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_SINGLE);
287 efl_ui_selectable_all_select(widget); 287 efl_ui_multi_selectable_all_select(widget);
288 efl_ui_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE); 288 efl_ui_multi_selectable_select_mode_set(widget, EFL_UI_SELECT_MODE_NONE);
289 for (int i = 0; i < efl_content_count(widget); ++i) 289 for (int i = 0; i < efl_content_count(widget); ++i)
290 { 290 {
291 if (efl_ui_selectable_selected_get(efl_pack_content_get(widget, i))) 291 if (efl_ui_selectable_selected_get(efl_pack_content_get(widget, i)))
diff --git a/src/tests/elocation/elocation_suite.c b/src/tests/elocation/elocation_suite.c
deleted file mode 100644
index afae6e0..0000000
--- a/src/tests/elocation/elocation_suite.c
+++ /dev/null
@@ -1,235 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include <stdlib.h>
6#include <stdio.h>
7
8#include <check.h>
9
10#include <Elocation.h>
11
12/* Test the init and shutdown pathes only. Good to do that as we don't set up
13 * other things and already triggered problems with this.
14 */
15EFL_START_TEST(elocation_test_init)
16{
17 Eina_Bool ret;
18
19 ret = elocation_init();
20 fail_if(ret != EINA_TRUE);
21
22 elocation_shutdown();
23}
24EFL_END_TEST
25
26/* Basic address object testing. Creating and freeing the object */
27EFL_START_TEST(elocation_test_address_object)
28{
29 Eina_Bool ret;
30 Elocation_Address *address = NULL;
31
32 ret = elocation_init();
33 fail_if(ret != EINA_TRUE);
34
35 address = elocation_address_new();
36 fail_if(address == NULL);
37
38 elocation_address_free(address);
39
40 elocation_shutdown();
41}
42EFL_END_TEST
43
44/* Basic position object testing. Creating and freeing the object */
45EFL_START_TEST(elocation_test_position_object)
46{
47 Eina_Bool ret;
48 Elocation_Position *position = NULL;
49
50 ret = elocation_init();
51 fail_if(ret != EINA_TRUE);
52
53 position = elocation_position_new();
54 fail_if(position == NULL);
55
56 elocation_position_free(position);
57
58 elocation_shutdown();
59}
60EFL_END_TEST
61
62/* Basic testing for the various functions of the GeoCode API */
63static int cb_count = 0;
64
65static Eina_Bool
66event_cb(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event)
67{
68 fail_if(event == NULL);
69
70 /* We expect 3 callbacks right now */
71 if (++cb_count == 3)
72 ecore_main_loop_quit();
73
74 return ECORE_CALLBACK_DONE;
75}
76
77EFL_START_TEST(elocation_test_api_geocode)
78{
79 Eina_Bool ret;
80 Elocation_Position *position = NULL;
81 Elocation_Address *address = NULL;
82 Ecore_Event_Handler *handler;
83
84 ret = elocation_init();
85 fail_if(ret != EINA_TRUE);
86
87 handler = ecore_event_handler_add(ELOCATION_EVENT_GEOCODE, event_cb, NULL);
88 fail_if(handler == NULL);
89
90 handler = ecore_event_handler_add(ELOCATION_EVENT_REVERSEGEOCODE, event_cb, NULL);
91 fail_if(handler == NULL);
92
93 position = elocation_position_new();
94 fail_if(position == NULL);
95
96 address = elocation_address_new();
97 fail_if(address == NULL);
98
99 ret = elocation_freeform_address_to_position("London", position);
100 fail_if(ret != EINA_TRUE);
101
102 position->latitude = 51.7522;
103 position->longitude = -1.25596;
104 position->accur->level = 3;
105 ret = elocation_position_to_address(position, address);
106 fail_if(ret != EINA_TRUE);
107
108 address->locality = strdup("Cambridge");
109 address->countrycode = strdup("UK");
110 ret = elocation_address_to_position(address, position);
111 fail_if(ret != EINA_TRUE);
112
113 ecore_main_loop_begin();
114
115 elocation_position_free(position);
116 elocation_address_free(address);
117
118 elocation_shutdown();
119}
120EFL_END_TEST
121
122/* Basic testing for position API */
123EFL_START_TEST(elocation_test_api_position)
124{
125 Eina_Bool ret;
126 Elocation_Position *position = NULL;
127
128 ret = elocation_init();
129 fail_if(ret != EINA_TRUE);
130
131 position = elocation_position_new();
132 fail_if(position == NULL);
133
134 ret = elocation_position_get(position);
135 fail_if(ret != EINA_TRUE);
136
137 elocation_position_free(position);
138
139 elocation_shutdown();
140}
141EFL_END_TEST
142
143/* Basic testing for address API */
144EFL_START_TEST(elocation_test_api_address)
145{
146 Eina_Bool ret;
147 Elocation_Address *address = NULL;
148
149 ret = elocation_init();
150 fail_if(ret != EINA_TRUE);
151
152 address = elocation_address_new();
153 fail_if(address == NULL);
154
155 ret = elocation_address_get(address);
156 fail_if(ret != EINA_TRUE);
157
158 elocation_address_free(address);
159
160 elocation_shutdown();
161}
162EFL_END_TEST
163
164/* Basic testing for status API */
165EFL_START_TEST(elocation_test_api_status)
166{
167 Eina_Bool ret;
168 int status = 0;
169
170 ret = elocation_init();
171 fail_if(ret != EINA_TRUE);
172
173 ret = elocation_status_get(&status);
174 fail_if(ret != EINA_TRUE);
175
176 elocation_shutdown();
177}
178EFL_END_TEST
179
180Suite *
181elocation_suite(void)
182{
183 Suite *s;
184 TCase *tc;
185
186 s = suite_create("Elocation");
187
188 tc = tcase_create("Elocation_Init");
189 tcase_add_test(tc, elocation_test_init);
190 suite_add_tcase(s, tc);
191
192 tc = tcase_create("Elocation_Objects");
193 tcase_add_test(tc, elocation_test_address_object);
194 tcase_add_test(tc, elocation_test_position_object);
195 suite_add_tcase(s, tc);
196
197 tc = tcase_create("Elocation_API_Geocode");
198 tcase_add_test(tc, elocation_test_api_geocode);
199 suite_add_tcase(s, tc);
200
201 tc = tcase_create("Elocation_API_Position");
202 tcase_add_test(tc, elocation_test_api_position);
203 suite_add_tcase(s, tc);
204
205 tc = tcase_create("Elocation_API_Address");
206 tcase_add_test(tc, elocation_test_api_address);
207 suite_add_tcase(s, tc);
208/*
209 tc = tcase_create("Elocation_API_Status");
210 tcase_add_test(tc, elocation_test_api_status);
211 suite_add_tcase(s, tc);
212*/
213 return s;
214}
215
216int
217main(void)
218{
219 Suite *s;
220 SRunner *sr;
221 int failed_count;
222
223#ifdef NEED_RUN_IN_TREE
224 putenv("EFL_RUN_IN_TREE=1");
225#endif
226
227 s = elocation_suite();
228 sr = srunner_create(s);
229 srunner_set_xml(sr, TESTS_BUILD_DIR "/check-results.xml");
230 srunner_run_all(sr, CK_ENV);
231 failed_count = srunner_ntests_failed(sr);
232 srunner_free(sr);
233
234 return (failed_count == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
235}
diff --git a/src/tests/eo/suite/eo_test_event.c b/src/tests/eo/suite/eo_test_event.c
index 9694ba3..f7a2670 100644
--- a/src/tests/eo/suite/eo_test_event.c
+++ b/src/tests/eo/suite/eo_test_event.c
@@ -185,12 +185,47 @@ EFL_START_TEST(eo_event_generation_bug)
185} 185}
186EFL_END_TEST 186EFL_END_TEST
187 187
188static void
189_inc_when_called(void *data, const Efl_Event *ev EINA_UNUSED)
190{
191 int *called = (int*)data;
192 *called += 1;
193}
194
195EFL_START_TEST(eo_event_fowarder_test)
196{
197 Eo *obj1, *obj2;
198 int called = 0;
199
200 obj1 = efl_add_ref(efl_test_event_class_get(), NULL);
201 obj2 = efl_add_ref(efl_test_event_class_get(), NULL);
202 efl_event_callback_add(obj2, EFL_TEST_EVENT_EVENT_TESTER, _inc_when_called, &called);
203
204 efl_event_callback_forwarder_priority_add(obj1, EFL_TEST_EVENT_EVENT_TESTER, EFL_CALLBACK_PRIORITY_BEFORE, obj2);
205 efl_event_callback_call(obj1, EFL_TEST_EVENT_EVENT_TESTER, NULL);
206 ck_assert_int_eq(called, 1);
207 called = 0;
208
209 //call it a second time with another forwarder
210 efl_event_callback_forwarder_priority_add(obj1, EFL_TEST_EVENT_EVENT_TESTER, EFL_CALLBACK_PRIORITY_BEFORE, obj2);
211 efl_event_callback_call(obj1, EFL_TEST_EVENT_EVENT_TESTER, NULL);
212 ck_assert_int_eq(called, 1); //we still should only emit it once
213 called = 0;
214
215 //delete it, nothing should happen now
216 efl_event_callback_forwarder_del(obj1, EFL_TEST_EVENT_EVENT_TESTER, obj2);
217 efl_event_callback_call(obj1, EFL_TEST_EVENT_EVENT_TESTER, NULL);
218 ck_assert_int_eq(called, 0);
219
220}
221EFL_END_TEST
188 222
189void eo_test_event(TCase *tc) 223void eo_test_event(TCase *tc)
190{ 224{
191 tcase_add_test(tc, eo_event); 225 tcase_add_test(tc, eo_event);
192 tcase_add_test(tc, eo_event_call_in_call); 226 tcase_add_test(tc, eo_event_call_in_call);
193 tcase_add_test(tc, eo_event_generation_bug); 227 tcase_add_test(tc, eo_event_generation_bug);
228 tcase_add_test(tc, eo_event_fowarder_test);
194} 229}
195 230
196 231
diff --git a/src/tests/eolian_js/test_object.eo b/src/tests/eolian_js/test_object.eo
index 1fc4623..21bc5b8 100644
--- a/src/tests/eolian_js/test_object.eo
+++ b/src/tests/eolian_js/test_object.eo
@@ -317,7 +317,7 @@ class Test.Object extends Efl.Object {
317 return: list<array<int> >; 317 return: list<array<int> >;
318 } 318 }
319 method_list_with_opaque_elements_check { 319 method_list_with_opaque_elements_check {
320 return: const(list<ptr(Elm.Calendar.Mark)>); 320 return: const(list<Elm.Calendar.Mark>);
321 } 321 }
322 method_in_enum_return_enum_check { 322 method_in_enum_return_enum_check {
323 params { e: Test.Enum_Ex; } 323 params { e: Test.Enum_Ex; }
diff --git a/src/tests/evas/efl_canvas_animation.c b/src/tests/evas/efl_canvas_animation.c
index cef0363..19b47a6 100644
--- a/src/tests/evas/efl_canvas_animation.c
+++ b/src/tests/evas/efl_canvas_animation.c
@@ -34,7 +34,58 @@ EFL_START_TEST(efl_canvas_animation_negative_double_checking)
34} 34}
35EFL_END_TEST 35EFL_END_TEST
36 36
37EFL_START_TEST(efl_canvas_animation_default_value)
38{
39 Efl_Canvas_Animation *animation = efl_new(EFL_CANVAS_ANIMATION_CLASS);
40
41 fail_if(efl_animation_duration_get(animation) == 0.0);
42}
43EFL_END_TEST
44
45static void
46_duration_zero_anim_running_cb(void *data, const Efl_Event *event)
47{
48 double animation_speed = *((double*) data);
49 double animation_running_position = *((double*) event->info);
50
51 if (animation_speed > 0.0)
52 ck_assert(EINA_DBL_EQ(animation_running_position, 1.0));
53 else
54 ck_assert(EINA_DBL_EQ(animation_running_position, 0.0));
55}
56
57static void
58helper_inc_int(void *data, const Efl_Event *event EINA_UNUSED)
59{
60 int *called = (int*) data;
61 *called+=1;
62}
63
64EFL_START_TEST(efl_canvas_animation_duration_zero)
65{
66 int running = 0;
67 Evas *evas = EVAS_TEST_INIT_EVAS();
68 Efl_Canvas_Rectangle *obj = efl_add(EFL_CANVAS_RECTANGLE_CLASS, evas);
69 Efl_Canvas_Animation *animation = efl_add(EFL_CANVAS_ANIMATION_CLASS, evas, efl_animation_duration_set(efl_added, 0.0));
70
71 double animation_speed = 1.0;
72 efl_event_callback_add(obj, EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _duration_zero_anim_running_cb, &animation_speed);
73 efl_event_callback_add(obj, EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, helper_inc_int , &running);
74 efl_canvas_object_animation_start(obj, animation, animation_speed, 0.0);
75 ck_assert(EINA_DBL_EQ(efl_canvas_object_animation_progress_get(obj), -1.0));
76 ck_assert_int_eq(running, 1);
77
78 running = 0;
79 animation_speed = -1.0;
80 efl_canvas_object_animation_start(obj, animation, animation_speed, 0.0);
81 ck_assert(EINA_DBL_EQ(efl_canvas_object_animation_progress_get(obj), -1.0));
82 ck_assert_int_eq(running, 1);
83}
84EFL_END_TEST
85
37void efl_test_canvas_animation(TCase *tc) 86void efl_test_canvas_animation(TCase *tc)
38{ 87{
39 tcase_add_test(tc, efl_canvas_animation_negative_double_checking); 88 tcase_add_test(tc, efl_canvas_animation_negative_double_checking);
89 tcase_add_test(tc, efl_canvas_animation_default_value);
90 tcase_add_test(tc, efl_canvas_animation_duration_zero);
40} 91}
diff --git a/src/tests/evas/evas_test_object.c b/src/tests/evas/evas_test_object.c
index d2de52a..7024488 100644
--- a/src/tests/evas/evas_test_object.c
+++ b/src/tests/evas/evas_test_object.c
@@ -5,10 +5,17 @@
5#include <stdio.h> 5#include <stdio.h>
6 6
7#include <Evas.h> 7#include <Evas.h>
8#define EFL_LOOP_PROTECTED //needed to set the loop time, we need that to simulate time passing for animation,tick
9#include <Ecore.h>
8 10
9#include "evas_suite.h" 11#include "evas_suite.h"
10#include "evas_tests_helpers.h" 12#include "evas_tests_helpers.h"
11 13
14static int called_changed;
15static Efl_Canvas_Animation *animation_changed_ev;
16static int called_running;
17static double animation_running_position;
18
12EFL_START_TEST(evas_object_various) 19EFL_START_TEST(evas_object_various)
13{ 20{
14 Evas *evas = EVAS_TEST_INIT_EVAS(); 21 Evas *evas = EVAS_TEST_INIT_EVAS();
@@ -51,8 +58,159 @@ EFL_START_TEST(evas_object_freeze_events)
51} 58}
52EFL_END_TEST 59EFL_END_TEST
53 60
61EFL_START_TEST(evas_object_animation_simple)
62{
63 Evas *evas = EVAS_TEST_INIT_EVAS();
64 Evas_Object *obj = evas_object_rectangle_add(evas);
65 Efl_Canvas_Animation *animation = efl_add(EFL_CANVAS_ANIMATION_CLASS, evas);
66
67 ck_assert_ptr_eq(efl_canvas_object_animation_get(obj) , NULL);
68 ck_assert(EINA_DBL_EQ(efl_canvas_object_animation_progress_get(obj), -1.0));
69
70 efl_canvas_object_animation_start(obj, animation, 1.0, 0.0);
71 ck_assert_ptr_eq(efl_canvas_object_animation_get(obj) , animation);
72 ck_assert(EINA_DBL_EQ(efl_canvas_object_animation_progress_get(obj), 0.0));
73
74 efl_canvas_object_animation_stop(obj);
75 ck_assert_ptr_eq(efl_canvas_object_animation_get(obj) , NULL);
76 ck_assert(EINA_DBL_EQ(efl_canvas_object_animation_progress_get(obj), -1.0));
77
78 efl_canvas_object_animation_start(obj, animation, 1.0, 0.0);
79 efl_canvas_object_animation_stop(obj);
80
81 efl_canvas_object_animation_start(obj, animation, -1.0, 1.0);
82 efl_canvas_object_animation_stop(obj);
83 efl_canvas_object_animation_stop(obj);
84}
85EFL_END_TEST
86
87EFL_START_TEST(evas_object_animation_progress)
88{
89 Evas *evas = EVAS_TEST_INIT_EVAS();
90 Evas_Object *obj = evas_object_rectangle_add(evas);
91 Efl_Canvas_Animation *animation = efl_add(EFL_CANVAS_ANIMATION_CLASS, evas, efl_animation_duration_set(efl_added, 1.0));
92
93 efl_canvas_object_animation_start(obj, animation, 1.0, 0.0);
94 efl_loop_time_set(efl_main_loop_get(), efl_loop_time_get(efl_main_loop_get()) + 0.5);
95 efl_event_callback_call(obj, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, NULL);
96 ck_assert(EINA_DBL_EQ(efl_canvas_object_animation_progress_get(obj), 0.5));
97 efl_canvas_object_animation_stop(obj);
98}
99EFL_END_TEST
100
101static inline void
102_simulate_time_passing(Eo *obj, double start, double jump)
103{
104 efl_loop_time_set(efl_main_loop_get(), start + jump);
105 efl_event_callback_call(obj, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, NULL);
106}
107
108static inline void
109_simulate_assert_time_passing(Eo *obj, double start, double jump, double expected_position)
110{
111 _simulate_time_passing(obj, start, jump);
112 ck_assert_int_eq((efl_canvas_object_animation_progress_get(obj)-expected_position)*10000, 0);
113}
114
115EFL_START_TEST(evas_object_animation_pause)
116{
117 Evas *evas = EVAS_TEST_INIT_EVAS();
118 Evas_Object *obj = evas_object_rectangle_add(evas);
119 double start = efl_loop_time_get(efl_main_loop_get());
120 Efl_Canvas_Animation *animation = efl_add(EFL_CANVAS_ANIMATION_CLASS, evas, efl_animation_duration_set(efl_added, 1.0));
121
122 efl_canvas_object_animation_start(obj, animation, 1.0, 0.0);
123
124 _simulate_assert_time_passing(obj, start, 0.2, 0.2);
125 efl_canvas_object_animation_pause_set(obj, EINA_TRUE);
126
127 _simulate_assert_time_passing(obj, start, 0.5, 0.2);
128 efl_canvas_object_animation_pause_set(obj, EINA_FALSE);
129
130 _simulate_assert_time_passing(obj, start, 0.7, 0.4);
131 efl_canvas_object_animation_stop(obj);
132}
133EFL_END_TEST
134
135EFL_START_TEST(evas_object_animation_error)
136{
137 Evas *evas = EVAS_TEST_INIT_EVAS();
138 Evas_Object *obj = evas_object_rectangle_add(evas);
139 Efl_Canvas_Animation *animation = efl_add(EFL_CANVAS_ANIMATION_CLASS, evas);
140 EXPECT_ERROR_START;
141 efl_canvas_object_animation_start(obj, NULL, 1.0, 0.0);
142 EXPECT_ERROR_END;
143
144 EXPECT_ERROR_START;
145 efl_canvas_object_animation_start(obj, animation, 0.0, 0.0);
146 EXPECT_ERROR_END;
147 efl_canvas_object_animation_stop(obj);
148
149 EXPECT_ERROR_START;
150 efl_canvas_object_animation_start(obj, animation, 1.0, 2.0);
151 EXPECT_ERROR_END;
152 efl_canvas_object_animation_stop(obj);
153
154 EXPECT_ERROR_START;
155 efl_canvas_object_animation_start(obj, animation, 1.0, -1.0);
156 EXPECT_ERROR_END;
157 efl_canvas_object_animation_stop(obj);
158}
159EFL_END_TEST
160
161static void
162_anim_changed_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
163{
164 animation_changed_ev = event->info;
165 called_changed ++;
166}
167
168static void
169_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
170{
171 animation_running_position = *((double*) event->info);
172 called_running ++;
173}
174
175EFL_CALLBACKS_ARRAY_DEFINE(animation_stats_cb,
176 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, _anim_changed_cb },
177 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _anim_running_cb },
178)
179
180EFL_START_TEST(evas_object_animation_events)
181{
182 Evas *evas = EVAS_TEST_INIT_EVAS();
183 Evas_Object *obj = evas_object_rectangle_add(evas);
184 double start = efl_loop_time_get(efl_main_loop_get());
185 Efl_Canvas_Animation *animation = efl_add(EFL_CANVAS_ANIMATION_CLASS, evas, efl_animation_duration_set(efl_added, 1.0));
186
187 efl_event_callback_array_add(obj, animation_stats_cb(), NULL);
188
189 efl_canvas_object_animation_start(obj, animation, 1.0, 0.0);
190
191 ck_assert_int_eq(called_changed, 1);
192 ck_assert_ptr_eq(animation_changed_ev, animation);
193 ck_assert_int_eq(called_running, 1);
194 ck_assert(EINA_DBL_EQ(animation_running_position, 0.0));
195
196 _simulate_time_passing(obj, start, 1.0);
197
198 ck_assert_int_eq(called_changed, 2);
199 ck_assert_ptr_eq(animation_changed_ev, NULL);
200 ck_assert_int_eq(called_running, 2);
201 ck_assert(EINA_DBL_EQ(animation_running_position, 1.0));
202 ck_assert_ptr_eq(efl_canvas_object_animation_get(obj), NULL);
203 ck_assert(EINA_DBL_EQ(efl_canvas_object_animation_progress_get(obj), -1.0));
204}
205EFL_END_TEST
206
54void evas_test_object(TCase *tc) 207void evas_test_object(TCase *tc)
55{ 208{
56 tcase_add_test(tc, evas_object_various); 209 tcase_add_test(tc, evas_object_various);
57 tcase_add_test(tc, evas_object_freeze_events); 210 tcase_add_test(tc, evas_object_freeze_events);
211 tcase_add_test(tc, evas_object_animation_simple);
212 tcase_add_test(tc, evas_object_animation_progress);
213 tcase_add_test(tc, evas_object_animation_pause);
214 tcase_add_test(tc, evas_object_animation_error);
215 tcase_add_test(tc, evas_object_animation_events);
58} 216}
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c
index f61574c..786be4a 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -37,6 +37,7 @@ static const char *style_buf =
37 Evas_Object *tb; \ 37 Evas_Object *tb; \
38 Evas_Textblock_Style *st; \ 38 Evas_Textblock_Style *st; \
39 Evas_Textblock_Cursor *cur; \ 39 Evas_Textblock_Cursor *cur; \
40 Efl_Text_Cursor *cur_obj; \
40 evas = EVAS_TEST_INIT_EVAS(); \ 41 evas = EVAS_TEST_INIT_EVAS(); \
41 evas_font_hinting_set(evas, EVAS_FONT_HINTING_AUTO); \ 42 evas_font_hinting_set(evas, EVAS_FONT_HINTING_AUTO); \
42 tb = evas_object_textblock_add(evas); \ 43 tb = evas_object_textblock_add(evas); \
@@ -48,6 +49,9 @@ static const char *style_buf =
48 fail_if(strcmp(style_buf, evas_textblock_style_get(st))); \ 49 fail_if(strcmp(style_buf, evas_textblock_style_get(st))); \
49 evas_object_textblock_style_set(tb, st); \ 50 evas_object_textblock_style_set(tb, st); \
50 cur = evas_object_textblock_cursor_new(tb); \ 51 cur = evas_object_textblock_cursor_new(tb); \
52 cur_obj =efl_canvas_textblock_cursor_create(tb);\
53 (void) cur_obj;\
54 (void) cur;\
51do \ 55do \
52{ \ 56{ \
53} \ 57} \
@@ -58,6 +62,7 @@ do \
58{ \ 62{ \
59 evas_textblock_cursor_free(cur); \ 63 evas_textblock_cursor_free(cur); \
60 evas_object_del(tb); \ 64 evas_object_del(tb); \
65 efl_del(cur_obj); \
61 evas_textblock_style_free(st); \ 66 evas_textblock_style_free(st); \
62 evas_free(evas); \ 67 evas_free(evas); \
63} \ 68} \
@@ -4304,43 +4309,6 @@ EFL_START_TEST(evas_textblock_text_iface)
4304} 4309}
4305EFL_END_TEST; 4310EFL_END_TEST;
4306 4311
4307static void
4308_test_check_annotation(Evas_Object *tb,
4309 size_t start_pos, size_t end_pos,
4310 size_t len, const char **formats)
4311{
4312 Efl_Text_Annotate_Annotation *an;
4313 Efl_Text_Cursor_Cursor *start, *end;
4314
4315 start = evas_object_textblock_cursor_new(tb);
4316 end = evas_object_textblock_cursor_new(tb);
4317
4318 evas_textblock_cursor_pos_set(start, start_pos);
4319 evas_textblock_cursor_pos_set(end, end_pos);
4320
4321 Eina_Iterator *it =
4322 efl_text_range_annotations_get(tb, start, end);
4323
4324 evas_textblock_cursor_free(start);
4325 evas_textblock_cursor_free(end);
4326
4327 size_t i = 0;
4328 EINA_ITERATOR_FOREACH(it, an)
4329 {
4330 const char *fmt = efl_text_annotation_get(tb,
4331 an);
4332 ck_assert_msg((i < len),
4333 "No formats to check but current annotation is: %s\n", fmt);
4334 ck_assert_str_eq(fmt, *formats);
4335 formats++;
4336 i++;
4337 }
4338 ck_assert_msg((i == len),
4339 "Expected next format (index %lu): %s, but reached end of annotations\n",
4340 i, *formats);
4341
4342 eina_iterator_free(it);
4343}
4344 4312
4345#define _COMP_STR(...) ((const char *[]) { __VA_ARGS__ }) 4313#define _COMP_STR(...) ((const char *[]) { __VA_ARGS__ })
4346#define _CREATE_PARAMS(X) (sizeof(X) / sizeof(X[0])), (X) 4314#define _CREATE_PARAMS(X) (sizeof(X) / sizeof(X[0])), (X)
@@ -4349,11 +4317,10 @@ _test_check_annotation(Evas_Object *tb,
4349EFL_START_TEST(evas_textblock_annotation) 4317EFL_START_TEST(evas_textblock_annotation)
4350{ 4318{
4351 START_TB_TEST(); 4319 START_TB_TEST();
4352 Efl_Text_Annotate_Annotation *an, *an2; 4320 Efl_Text_Cursor *start, *end;
4353 Efl_Text_Cursor_Cursor *start, *end;
4354 4321
4355 start = evas_object_textblock_cursor_new(tb); 4322 start = efl_canvas_textblock_cursor_create(tb);
4356 end = evas_object_textblock_cursor_new(tb); 4323 end = efl_canvas_textblock_cursor_create(tb);
4357 4324
4358 const char *buf = 4325 const char *buf =
4359 "This text will check annotation." 4326 "This text will check annotation."
@@ -4365,210 +4332,78 @@ EFL_START_TEST(evas_textblock_annotation)
4365 efl_text_set(tb, buf); 4332 efl_text_set(tb, buf);
4366 4333
4367 /* Check some trivial cases */ 4334 /* Check some trivial cases */
4368 evas_textblock_cursor_pos_set(start, 0);
4369 evas_textblock_cursor_pos_set(end, 3);
4370 ck_assert(!efl_text_annotation_insert(tb, start, end, NULL));
4371 evas_textblock_cursor_pos_set(start, 0);
4372 evas_textblock_cursor_pos_set(end, 3);
4373 ck_assert(!efl_text_annotation_insert(tb, start, end, ""));
4374 evas_textblock_cursor_pos_set(start, 1);
4375 evas_textblock_cursor_pos_set(end, 0);
4376 ck_assert(!efl_text_annotation_insert(tb, start, end, "color=#fff"));
4377
4378 /* Insert and check correct positions */
4379 _test_check_annotation(tb, 0, 10, _COMP_PARAMS());
4380
4381 evas_textblock_cursor_pos_set(start, 0);
4382 evas_textblock_cursor_pos_set(end, 3);
4383 efl_text_annotation_insert(tb, start, end, "font_weight=bold");
4384 _test_check_annotation(tb, 0, 2, _COMP_PARAMS("font_weight=bold"));
4385 _test_check_annotation(tb, 0, 2, _COMP_PARAMS("font_weight=bold"));
4386 _test_check_annotation(tb, 4, 10, _COMP_PARAMS());
4387
4388 evas_textblock_cursor_pos_set(start, 50);
4389 evas_textblock_cursor_pos_set(end, 60);
4390 efl_text_annotation_insert(tb, start, end, "color=#0ff");
4391 _test_check_annotation(tb, 0, 49, _COMP_PARAMS("font_weight=bold"));
4392 _test_check_annotation(tb, 0, 50, _COMP_PARAMS("font_weight=bold", "color=#0ff"));
4393 _test_check_annotation(tb, 0, 55, _COMP_PARAMS("font_weight=bold", "color=#0ff"));
4394 _test_check_annotation(tb, 0, 59, _COMP_PARAMS("font_weight=bold", "color=#0ff"));
4395 _test_check_annotation(tb, 40, 50, _COMP_PARAMS("color=#0ff"));
4396 _test_check_annotation(tb, 40, 51, _COMP_PARAMS("color=#0ff"));
4397 _test_check_annotation(tb, 40, 61, _COMP_PARAMS("color=#0ff"));
4398 _test_check_annotation(tb, 59, 60, _COMP_PARAMS("color=#0ff"));
4399 _test_check_annotation(tb, 60, 61, _COMP_PARAMS());
4400
4401 /* See that annotation's positions are updated as text is inserted */
4402 efl_text_set(tb, "hello");
4403 evas_textblock_cursor_pos_set(start, 0);
4404 evas_textblock_cursor_pos_set(end, 2);
4405 an = efl_text_annotation_insert(tb, start, end, "color=#fff");
4406 _test_check_annotation(tb, 2, 3, _COMP_PARAMS());
4407 evas_textblock_cursor_pos_set(cur, 0);
4408 evas_textblock_cursor_text_append(cur, "a");
4409 _test_check_annotation(tb, 2, 3, _COMP_PARAMS("color=#fff"));
4410 _test_check_annotation(tb, 3, 4, _COMP_PARAMS());
4411
4412 /* Replace annotations's format */
4413 efl_text_annotation_set(tb, an, "font_size=14");
4414 _test_check_annotation(tb, 2, 3, _COMP_PARAMS("font_size=14"));
4415 _test_check_annotation(tb, 3, 4, _COMP_PARAMS());
4416
4417 efl_text_set(tb, "hello world");
4418 evas_textblock_cursor_pos_set(start, 0);
4419 evas_textblock_cursor_pos_set(end, 2);
4420 an = efl_text_annotation_insert(tb, start, end, "color=#fff");
4421 evas_textblock_cursor_pos_set(start, 2);
4422 evas_textblock_cursor_pos_set(end, 3);
4423 an2 = efl_text_annotation_insert(tb, start, end, "font_size=14");
4424 _test_check_annotation(tb, 0, 1, _COMP_PARAMS("color=#fff"));
4425 _test_check_annotation(tb, 2, 3, _COMP_PARAMS("font_size=14"));
4426 _test_check_annotation(tb, 0, 3, _COMP_PARAMS("color=#fff", "font_size=14"));
4427 efl_text_annotation_set(tb, an, "font_size=10");
4428 efl_text_annotation_set(tb, an2, "color=#000");
4429 _test_check_annotation(tb, 2, 3, _COMP_PARAMS("color=#000"));
4430 _test_check_annotation(tb, 0, 1, _COMP_PARAMS("font_size=10"));
4431 _test_check_annotation(tb, 0, 3, _COMP_PARAMS("font_size=10", "color=#000"));
4432
4433 /* Delete annotations directly */
4434 efl_text_set(tb, "hello world");
4435 evas_textblock_cursor_pos_set(start, 0);
4436 evas_textblock_cursor_pos_set(end, 2);
4437 an = efl_text_annotation_insert(tb, start, end, "color=#fff");
4438 evas_textblock_cursor_pos_set(start, 3);
4439 evas_textblock_cursor_pos_set(end, 4);
4440 an2 = efl_text_annotation_insert(tb, start, end, "font_size=14");
4441 efl_text_annotation_del(tb, an);
4442 _test_check_annotation(tb, 0, 3, _COMP_PARAMS("font_size=14"));
4443 efl_text_annotation_del(tb, an2);
4444 _test_check_annotation(tb, 0, 3, _COMP_PARAMS());
4445 evas_textblock_cursor_pos_set(start, 0);
4446 evas_textblock_cursor_pos_set(end, 1);
4447 an = efl_text_annotation_insert(tb, start, end, "color=#fff");
4448 _test_check_annotation(tb, 1, 3, _COMP_PARAMS());
4449 _test_check_annotation(tb, 0, 0, _COMP_PARAMS("color=#fff"));
4450 efl_text_annotation_del(tb, an);
4451 _test_check_annotation(tb, 0, 0, _COMP_PARAMS());
4452
4453 /* Check blocking of "item formats" */
4454 efl_text_set(tb, "hello world");
4455 evas_textblock_cursor_pos_set(start, 0);
4456 evas_textblock_cursor_pos_set(end, 1);
4457 efl_text_annotation_insert(tb, start, end, "ps");
4458 _test_check_annotation(tb, 0, 1, _COMP_PARAMS());
4459 evas_textblock_cursor_pos_set(start, 0);
4460 evas_textblock_cursor_pos_set(end, 1);
4461 efl_text_annotation_insert(tb, start, end, "color=#fff");
4462 _test_check_annotation(tb, 0, 1, _COMP_PARAMS("color=#fff"));
4463 evas_textblock_cursor_pos_set(start, 2);
4464 evas_textblock_cursor_pos_set(end, 3);
4465 efl_text_annotation_insert(tb, start, end, "br");
4466 evas_textblock_cursor_pos_set(start, 6);
4467 evas_textblock_cursor_pos_set(end, 7);
4468 efl_text_annotation_insert(tb, start, end, "item");
4469 _test_check_annotation(tb, 0, 8, _COMP_PARAMS("color=#fff"));
4470
4471 /* Check "item" annotations */
4472 efl_text_set(tb, "abcd");
4473 evas_textblock_cursor_pos_set(cur, 4);
4474 an = efl_text_cursor_item_insert(tb, cur, "", "size=16x16");
4475 _test_check_annotation(tb, 4, 4, _COMP_PARAMS("size=16x16 href="));
4476
4477 /* Check that format is not extended if it's an "object item" */
4478 evas_textblock_cursor_pos_set(cur, 5);
4479 efl_text_cursor_text_insert(tb, cur, "a");
4480 _test_check_annotation(tb, 5, 7, _COMP_PARAMS());
4481 _test_check_annotation(tb, 0, 3, _COMP_PARAMS());
4482
4483 /* Remove annotation of "item" also removes the OBJ character */
4484 {
4485 int blen, len;
4486 evas_textblock_cursor_pos_set(cur, 5);
4487 blen = evas_textblock_cursor_paragraph_text_length_get(cur);
4488 efl_text_annotation_del(tb, an);
4489 len = evas_textblock_cursor_paragraph_text_length_get(cur);
4490 ck_assert_int_eq(len, blen - 1);
4491 _test_check_annotation(tb, 0, 5, _COMP_PARAMS());
4492 }
4493
4494 /* Using annotations with new text API */
4495 efl_text_set(tb, "hello");
4496 evas_textblock_cursor_pos_set(start, 0);
4497 evas_textblock_cursor_pos_set(end, 5);
4498 efl_text_annotation_insert(tb, start, end, "color=#fff");
4499 _test_check_annotation(tb, 3, 3, _COMP_PARAMS("color=#fff"));
4500 /* Old API */
4501 evas_textblock_cursor_pos_set(cur, 5);
4502 efl_text_cursor_text_insert(tb, cur, "a");
4503 _test_check_annotation(tb, 0, 0, _COMP_PARAMS("color=#fff"));
4504 _test_check_annotation(tb, 5, 5, _COMP_PARAMS());
4505
4506 /* Specific case with PS */
4507 efl_text_set(tb, "hello\nworld");
4508 evas_textblock_cursor_pos_set(start, 0);
4509 evas_textblock_cursor_pos_set(end, 5);
4510 efl_text_annotation_insert(tb, start, end, "color=#fff");
4511 _test_check_annotation(tb, 4, 4, _COMP_PARAMS("color=#fff"));
4512 evas_textblock_cursor_pos_set(cur, 4);
4513 /* Cursor position is now: hello|\nworld */
4514 efl_text_cursor_text_insert(tb, cur, "a");
4515 _test_check_annotation(tb, 0, 0, _COMP_PARAMS("color=#fff"));
4516 _test_check_annotation(tb, 5, 5, _COMP_PARAMS("color=#fff"));
4517
4518 /* Test getting of object item */
4519 evas_textblock_cursor_pos_set(cur, 4);
4520 an = efl_text_cursor_item_annotation_get(tb, cur);
4521 ck_assert(!an);
4522
4523 an = efl_text_cursor_item_insert(tb, cur, "", "size=16x16");
4524 evas_textblock_cursor_pos_set(cur, 4);
4525 an = efl_text_cursor_item_annotation_get(tb, cur);
4526 ck_assert(an);
4527 ck_assert_str_eq("size=16x16 href=", efl_text_annotation_get(tb, an));
4528 4335
4529 END_TB_TEST(); 4336 efl_text_cursor_position_set(start, 0);
4337 efl_text_cursor_position_set(end, 3);
4338 efl_text_attribute_factory_attribute_insert(start, end, "font_size=80");
4339 efl_text_cursor_position_set(start, 1);
4340 efl_text_cursor_position_set(end, 2);
4341 efl_text_attribute_factory_attribute_insert(start, end, "font=arial");
4342 efl_text_cursor_position_set(start, 2);
4343 efl_text_cursor_position_set(end, 3);
4344 efl_text_attribute_factory_attribute_insert(start, end, "color=#fff");
4345
4346 efl_text_cursor_position_set(start, 0);
4347 efl_text_cursor_position_set(end, 3);
4348 unsigned int count = efl_text_attribute_factory_attribute_clear(start, end);
4349 fail_if(count != 3);
4530} 4350}
4531EFL_END_TEST; 4351EFL_END_TEST;
4532 4352
4533#define START_EFL_CANVAS_TEXT_TEST() \ 4353static const char *efl_style_buf =
4354 "" TEST_FONT " font_size=10 color=#000 text_class=entry";
4355
4356#define START_EFL_CANVAS_TEXTBLOCK_TEST() \
4534 Evas *evas; \ 4357 Evas *evas; \
4535 Eo *txt; \ 4358 Eo *txt; \
4536 Efl_Text_Cursor_Cursor *cur; \ 4359 Efl_Text_Cursor_Handle *cur; \
4360 Efl_Text_Cursor *cur_obj; \
4537 evas = EVAS_TEST_INIT_EVAS(); \ 4361 evas = EVAS_TEST_INIT_EVAS(); \
4538 evas_font_hinting_set(evas, EVAS_FONT_HINTING_AUTO); \ 4362 evas_font_hinting_set(evas, EVAS_FONT_HINTING_AUTO); \
4539 txt = efl_add(EFL_CANVAS_TEXT_CLASS, evas); \ 4363 txt = efl_add(EFL_CANVAS_TEXTBLOCK_CLASS, evas); \
4540 fail_if(!txt); \ 4364 fail_if(!txt); \
4541 efl_canvas_text_legacy_newline_set(txt, EINA_FALSE); \ 4365 efl_canvas_textblock_newline_as_paragraph_separator_set(txt, EINA_FALSE); \
4542 efl_canvas_text_style_set(txt, NULL, style_buf); \ 4366 efl_canvas_textblock_style_apply(txt, efl_style_buf); \
4543 fail_if(!efl_canvas_text_style_get(txt, NULL) || \ 4367 fail_if(!efl_canvas_textblock_all_styles_get(txt)); \
4544 strcmp(style_buf, efl_canvas_text_style_get(txt, NULL))); \ 4368 cur_obj = efl_canvas_textblock_cursor_create(txt);\
4545 cur = efl_text_cursor_new(txt); \ 4369 cur = evas_object_textblock_cursor_new(txt); \
4546 fail_if(!cur); \ 4370 fail_if(!cur); \
4547do \ 4371do \
4548{ \ 4372{ \
4549} \ 4373} \
4550while (0) 4374while (0)
4551 4375
4552#define END_EFL_CANVAS_TEXT_TEST() \ 4376#define END_EFL_CANVAS_TEXTBLOCK_TEST() \
4553do \ 4377do \
4554{ \ 4378{ \
4555 efl_text_cursor_free(txt, cur); \ 4379 efl_del(cur_obj); \
4380 evas_textblock_cursor_free(cur); \
4556 efl_del(txt); \ 4381 efl_del(txt); \
4557 evas_free(evas); \ 4382 evas_free(evas); \
4558} \ 4383} \
4559while (0) 4384while (0)
4560 4385
4561EFL_START_TEST(efl_canvas_text_simple) 4386EFL_START_TEST(efl_canvas_textblock_simple)
4562{ 4387{
4563 START_EFL_CANVAS_TEXT_TEST(); 4388 START_EFL_CANVAS_TEXTBLOCK_TEST();
4564 4389
4565 /* It is simple test for Efl_Canvas_Text. 4390 /* It is simple test for Efl_Canvas_Textblock.
4566 * The main object is "txt". */ 4391 * The main object is "txt". */
4567 const char *buf = "Th<i>i</i>s is a <br/> te<b>s</b>t."; 4392 const char *buf = "Th<i>i</i>s is a <br/> te<b>s</b>t.";
4568 efl_text_set(txt, buf); 4393 efl_text_set(txt, buf);
4569 fail_if(strcmp(efl_text_get(txt), buf)); 4394 fail_if(strcmp(efl_text_get(txt), buf));
4570 4395
4571 END_EFL_CANVAS_TEXT_TEST(); 4396 /* Check if password is false by default*/
4397 Eina_Bool password = efl_text_password_get(txt);
4398 fail_if(password);
4399 efl_text_password_set(txt, EINA_TRUE);
4400 password = efl_text_password_get(txt);
4401 fail_if(!password);
4402 efl_text_password_set(txt, EINA_FALSE);
4403 password = efl_text_password_get(txt);
4404 fail_if(password);
4405
4406 END_EFL_CANVAS_TEXTBLOCK_TEST();
4572} 4407}
4573EFL_END_TEST 4408EFL_END_TEST
4574 4409
@@ -4580,19 +4415,24 @@ EFL_START_TEST(efl_text)
4580 Evas_Coord x, x2; 4415 Evas_Coord x, x2;
4581 Evas_Coord nw, nh; 4416 Evas_Coord nw, nh;
4582 Evas_Coord cx, cx2; 4417 Evas_Coord cx, cx2;
4418 Eina_Size2D size;
4583 4419
4584 /* Split cursor in LTR paragraph. 4420 /* Split cursor in LTR paragraph.
4585 * Russian 't' in the beginnning to create additional item.*/ 4421 * Russian 't' in the beginnning to create additional item.*/
4586 /*01234 5 6789012345678 19 01234 */ 4422 /*01234 5 6789012345678 19 01234 */
4587 efl_text_set(tb, "тest \u202bנסיוןabcנסיון\u202c bang"); 4423 efl_text_set(tb, "тest \u202bנסיוןabcנסיון\u202c bang");
4588 efl_canvas_text_size_native_get(tb, &nw, &nh); 4424 size = efl_canvas_textblock_size_native_get(tb);
4425 nw = size.w;
4426 nh = size.h;
4427
4589 efl_gfx_entity_size_set(tb, EINA_SIZE2D(nw, nh)); 4428 efl_gfx_entity_size_set(tb, EINA_SIZE2D(nw, nh));
4590 4429
4591 /* Logical cursor after "test " */ 4430 /* Logical cursor after "test " */
4592 evas_textblock_cursor_pos_set(cur, 6); 4431 evas_textblock_cursor_pos_set(cur, 6);
4593 fail_if(!efl_text_cursor_geometry_get(tb, cur, 4432 fail_if(!evas_textblock_cursor_geometry_bidi_get(cur,
4594 EFL_TEXT_CURSOR_TYPE_BEFORE, &cx, NULL, NULL, NULL, &cx2, 4433 &cx, NULL, NULL, NULL, &cx2,
4595 NULL, NULL, NULL)); 4434 NULL, NULL, NULL, EVAS_TEXTBLOCK_CURSOR_BEFORE));
4435
4596 evas_textblock_cursor_pos_set(cur, 18); 4436 evas_textblock_cursor_pos_set(cur, 18);
4597 evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL); 4437 evas_textblock_cursor_pen_geometry_get(cur, &x, NULL, NULL, NULL);
4598 evas_textblock_cursor_pos_set(cur, 20); 4438 evas_textblock_cursor_pos_set(cur, 20);
@@ -4605,104 +4445,189 @@ EFL_START_TEST(efl_text)
4605} 4445}
4606EFL_END_TEST 4446EFL_END_TEST
4607 4447
4608EFL_START_TEST(efl_canvas_text_cursor) 4448EFL_START_TEST(efl_canvas_textblock_cursor)
4609{ 4449{
4610 START_EFL_CANVAS_TEXT_TEST(); 4450 START_EFL_CANVAS_TEXTBLOCK_TEST();
4611 int pos; 4451 int pos;
4612 4452
4613 const char *buf = "abcdefghij"; 4453 const char *buf = "abcdefghij";
4614 efl_text_set(txt, buf); 4454 efl_text_set(txt, buf);
4615 fail_if(strcmp(efl_text_get(txt), buf)); 4455 fail_if(strcmp(efl_text_get(txt), buf));
4616 4456
4617 efl_text_cursor_line_jump_by(txt, cur, -1); 4457 efl_text_cursor_line_jump_by(cur_obj, -1);
4618 pos = efl_text_cursor_position_get(txt, cur); 4458 pos = efl_text_cursor_position_get(cur_obj);
4619 ck_assert_int_eq(pos, 0); 4459 ck_assert_int_eq(pos, 0);
4620 efl_text_cursor_line_jump_by(txt, cur, 1); 4460 efl_text_cursor_line_jump_by(cur_obj, 1);
4621 pos = efl_text_cursor_position_get(txt, cur); 4461 pos = efl_text_cursor_position_get(cur_obj);
4622 ck_assert_int_eq(pos, 10); 4462 ck_assert_int_eq(pos, 10);
4623 4463
4624 END_EFL_CANVAS_TEXT_TEST(); 4464
4465 Eo * cursor1 = efl_add(EFL_TEXT_CURSOR_CLASS, txt);
4466 pos = efl_text_cursor_position_get(cursor1);
4467 ck_assert_int_eq(pos, -1);
4468 efl_text_cursor_position_set(cursor1, 10);
4469 pos = efl_text_cursor_position_get(cursor1);
4470 ck_assert_int_eq(pos, -1);
4471
4472 efl_canvas_textblock_cursor_add(txt, cursor1);
4473 efl_text_cursor_position_set(cursor1, 1);
4474 pos = efl_text_cursor_position_get(cursor1);
4475 ck_assert_int_eq(pos, 1);
4476
4477 END_EFL_CANVAS_TEXTBLOCK_TEST();
4625} 4478}
4626EFL_END_TEST 4479EFL_END_TEST
4627 4480
4628 4481
4629EFL_START_TEST(efl_canvas_text_markup) 4482EFL_START_TEST(efl_canvas_textblock_markup)
4630{ 4483{
4631 START_EFL_CANVAS_TEXT_TEST(); 4484 START_EFL_CANVAS_TEXTBLOCK_TEST();
4632 Efl_Text_Cursor_Cursor *start, *end; 4485 Efl_Text_Cursor *start, *end;
4633 char *res; 4486 char *res;
4634 4487
4635 start = efl_text_cursor_new(txt); 4488 start = efl_canvas_textblock_cursor_create(txt);
4636 end = efl_text_cursor_new(txt); 4489 end = efl_canvas_textblock_cursor_create(txt);
4637 4490
4638 efl_text_set(txt, "\n\n\n"); 4491 efl_text_set(txt, "\n\n\n");
4639 4492
4640 efl_text_cursor_position_set(txt, start, 1); 4493 efl_text_cursor_position_set(start, 1);
4641 efl_text_cursor_position_set(txt, end, 2); 4494 efl_text_cursor_position_set(end, 2);
4642 res = efl_text_markup_interactive_markup_range_get(txt, start, end); 4495 res = efl_text_cursor_range_markup_get(start, end);
4643 ck_assert_str_eq(res, "<br>"); 4496 ck_assert_str_eq(res, "<br>");
4644 free(res); 4497 free(res);
4645 4498
4646 efl_text_set(txt, "a\u2029bc\ndef\n\u2029"); 4499 efl_text_set(txt, "a\u2029bc\ndef\n\u2029");
4647 efl_text_cursor_position_set(txt, start, 2); 4500 efl_text_cursor_position_set(start, 2);
4648 efl_text_cursor_position_set(txt, end, 5); 4501 efl_text_cursor_position_set(end, 5);
4649 res = efl_text_markup_interactive_markup_range_get(txt, start, end); 4502 res = efl_text_cursor_range_markup_get(start, end);
4650 ck_assert_str_eq(res, "bc<br>"); 4503 ck_assert_str_eq(res, "bc<br>");
4651 free(res); 4504 free(res);
4652 4505
4653 END_EFL_CANVAS_TEXT_TEST(); 4506 END_EFL_CANVAS_TEXTBLOCK_TEST();
4654} 4507}
4655EFL_END_TEST 4508EFL_END_TEST
4656 4509
4657EFL_START_TEST(efl_canvas_text_markup_invalid_escape) 4510EFL_START_TEST(efl_canvas_textblock_markup_invalid_escape)
4658{ 4511{
4659 START_EFL_CANVAS_TEXT_TEST(); 4512 START_EFL_CANVAS_TEXTBLOCK_TEST();
4660 4513
4661 char * text1 = "Hello"; 4514 char * text1 = "Hello";
4662 char * text2 = "Hello&123"; 4515 char * text2 = "Hello&123";
4663 char * text3 = "Hello&123&456"; 4516 char * text3 = "Hello&123&456";
4664 Evas_Coord fw1, fw2, fw3; 4517 Eina_Size2D fw1, fw2, fw3;
4665 4518
4666 efl_text_markup_set(txt,text1); 4519 efl_text_markup_set(txt,text1);
4667 efl_canvas_text_size_native_get(txt, &fw1, NULL); 4520 fw1 = efl_canvas_textblock_size_native_get(txt);
4668 efl_text_markup_set(txt,text2); 4521 efl_text_markup_set(txt,text2);
4669 efl_canvas_text_size_native_get(txt, &fw2, NULL); 4522 fw2 = efl_canvas_textblock_size_native_get(txt);
4670 fail_if(fw2 <= fw1); 4523 fail_if(fw2.w <= fw1.w);
4671 efl_text_markup_set(txt,text3); 4524 efl_text_markup_set(txt,text3);
4672 efl_canvas_text_size_native_get(txt, &fw3, NULL); 4525 fw3 = efl_canvas_textblock_size_native_get(txt);
4673 fail_if(fw3 <= fw2); 4526 fail_if(fw3.w <= fw2.w);
4674 4527
4675 END_EFL_CANVAS_TEXT_TEST(); 4528 END_EFL_CANVAS_TEXTBLOCK_TEST();
4676} 4529}
4677EFL_END_TEST 4530EFL_END_TEST
4678 4531
4679 4532
4680EFL_START_TEST(efl_text_font) 4533EFL_START_TEST(efl_text_font)
4681{ 4534{
4682 START_EFL_CANVAS_TEXT_TEST(); 4535 START_EFL_CANVAS_TEXTBLOCK_TEST();
4683 4536
4684 efl_text_set(txt, "\n\n\n"); 4537 efl_text_set(txt, "\n\n\n");
4685 4538
4686 const char * font; 4539 const char * font;
4687 int font_size; 4540 int font_size;
4688 efl_text_font_set(txt, "Sans", 20); 4541 efl_text_font_family_set(txt, "Sans");
4689 efl_text_font_set(txt, NULL, 0); 4542 efl_text_font_size_set(txt, 20);
4543 efl_text_font_family_set(txt, NULL);
4544 efl_text_font_size_set(txt, 0);
4690 4545
4691 efl_text_font_get(txt, &font, &font_size); 4546 font = efl_text_font_family_get(txt);
4547 font_size = efl_text_font_size_get(txt);
4692 fail_if(20 != font_size); 4548 fail_if(20 != font_size);
4693 fail_if(strcmp(font,"Sans")); 4549 fail_if(strcmp(font,"Sans"));
4694 4550
4695 efl_text_font_set(txt, NULL, 30); 4551 efl_text_font_family_set(txt, NULL);
4696 efl_text_font_get(txt, &font, &font_size); 4552 efl_text_font_size_set(txt, 30);
4553 font = efl_text_font_family_get(txt);
4554 font_size = efl_text_font_size_get(txt);
4697 fail_if(30 != font_size); 4555 fail_if(30 != font_size);
4698 fail_if(strcmp(font,"Sans")); 4556 fail_if(strcmp(font,"Sans"));
4699 4557
4700 efl_text_font_set(txt, "arial", 0); 4558 efl_text_font_family_set(txt, "arial");
4701 efl_text_font_get(txt, &font, &font_size); 4559 efl_text_font_size_set(txt, 0);
4560 font = efl_text_font_family_get(txt);
4561 font_size = efl_text_font_size_get(txt);
4702 fail_if(30 != font_size); 4562 fail_if(30 != font_size);
4703 fail_if(strcmp(font,"arial")); 4563 fail_if(strcmp(font,"arial"));
4704 4564
4705 END_EFL_CANVAS_TEXT_TEST(); 4565 END_EFL_CANVAS_TEXTBLOCK_TEST();
4566}
4567EFL_END_TEST
4568
4569EFL_START_TEST(efl_canvas_textblock_style)
4570{
4571 START_EFL_CANVAS_TEXTBLOCK_TEST();
4572 unsigned char r, g, b, a;
4573 const char *style;
4574
4575 efl_text_password_set(txt, EINA_FALSE);
4576 efl_text_underline_type_set(txt, EFL_TEXT_STYLE_UNDERLINE_TYPE_DOUBLE);
4577 efl_text_font_weight_set(txt, EFL_TEXT_FONT_WEIGHT_EXTRABOLD);
4578 efl_text_font_slant_set(txt, EFL_TEXT_FONT_SLANT_OBLIQUE);
4579 efl_text_tabstops_set(txt, 20);
4580
4581 efl_canvas_textblock_style_apply(txt, "color=#90E135");
4582
4583 style = efl_canvas_textblock_all_styles_get(txt);
4584
4585 // from efl_style_buf
4586 fail_if(!strstr(style, "font=DejaVuSans,UnDotum,malayalam"));
4587 // default value
4588 fail_if(!strstr(style, "font_width=normal"));
4589
4590 // from functions
4591 fail_if(!strstr(style, "font_weight=extrabold"));
4592 fail_if(!strstr(style, "tabstops=20"));
4593 fail_if(!strstr(style, "color=rgba(144,225,53,255)"));
4594 fail_if(!strstr(style, "password=off"));
4595 efl_text_password_set(txt, EINA_TRUE);
4596 style = efl_canvas_textblock_all_styles_get(txt);
4597 fail_if(!strstr(style, "password=on"));
4598
4599 efl_canvas_textblock_style_apply(txt, "font_width=ultracondensed");
4600 ck_assert_int_eq(efl_text_font_width_get(txt), EFL_TEXT_FONT_WIDTH_ULTRACONDENSED);
4601
4602 efl_canvas_textblock_style_apply(txt, "wrap=none");
4603 ck_assert_int_eq(efl_text_wrap_get(txt), EFL_TEXT_FORMAT_WRAP_NONE);
4604
4605 efl_canvas_textblock_style_apply(txt, "backing=on");
4606 ck_assert_int_eq(efl_text_backing_type_get(txt), EFL_TEXT_STYLE_BACKING_TYPE_ENABLED);
4607
4608 efl_canvas_textblock_style_apply(txt, "style=far_soft_shadow");
4609 ck_assert_int_eq(efl_text_effect_type_get(txt), EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SOFT_SHADOW);
4610
4611 efl_canvas_textblock_style_apply(txt, "style=glow,top_right");
4612 ck_assert_int_eq(efl_text_effect_type_get(txt), EFL_TEXT_STYLE_EFFECT_TYPE_GLOW);
4613 ck_assert_int_eq(efl_text_shadow_direction_get(txt), EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT);
4614
4615 efl_canvas_textblock_style_apply(txt, "style=far_shadow,top");
4616 ck_assert_int_eq(efl_text_effect_type_get(txt), EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SHADOW);
4617 ck_assert_int_eq(efl_text_shadow_direction_get(txt), EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP);
4618
4619 efl_canvas_textblock_style_apply(txt, "style=soft_outline,top,bottom");
4620 ck_assert_int_eq(efl_text_effect_type_get(txt), EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_OUTLINE);
4621 ck_assert_int_eq(efl_text_shadow_direction_get(txt), EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM);
4622
4623 efl_canvas_textblock_style_apply(txt, "color=#EF596C");
4624 efl_text_normal_color_get(txt, &r, &g, &b, &a);
4625 ck_assert_int_eq(r, 0xEF);
4626 ck_assert_int_eq(g, 0x59);
4627 ck_assert_int_eq(b, 0x6C);
4628 ck_assert_int_eq(a, 0xFF);
4629
4630 END_EFL_CANVAS_TEXTBLOCK_TEST();
4706} 4631}
4707EFL_END_TEST 4632EFL_END_TEST
4708 4633
@@ -4734,11 +4659,12 @@ void evas_test_textblock(TCase *tc)
4734#endif 4659#endif
4735 tcase_add_test(tc, evas_textblock_text_iface); 4660 tcase_add_test(tc, evas_textblock_text_iface);
4736 tcase_add_test(tc, evas_textblock_annotation); 4661 tcase_add_test(tc, evas_textblock_annotation);
4737 tcase_add_test(tc, efl_canvas_text_simple); 4662 tcase_add_test(tc, efl_canvas_textblock_simple);
4738 tcase_add_test(tc, efl_text); 4663 tcase_add_test(tc, efl_text);
4739 tcase_add_test(tc, efl_canvas_text_cursor); 4664 tcase_add_test(tc, efl_canvas_textblock_cursor);
4740 tcase_add_test(tc, efl_canvas_text_markup); 4665 tcase_add_test(tc, efl_canvas_textblock_markup);
4741 tcase_add_test(tc, efl_canvas_text_markup_invalid_escape); 4666 tcase_add_test(tc, efl_canvas_textblock_markup_invalid_escape);
4742 tcase_add_test(tc, efl_text_font); 4667 tcase_add_test(tc, efl_text_font);
4668 tcase_add_test(tc, efl_canvas_textblock_style);
4743} 4669}
4744 4670