summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHosang Kim <hosang12.kim@samsung.com>2015-09-02 16:16:04 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-09-04 14:00:11 +0900
commitf5c96735978257929dc38e0145732d4ee963483b (patch)
treeb21b5a4687beae2a755f1fc681df467d5c781cd8
parent3190c11c83a941f559a02ab06820108e0189af15 (diff)
elm_test: Add test case for page scroller
Signed-off-by: Jean-Philippe Andre <jp.andre@samsung.com>
-rw-r--r--data/objects/test.edc37
-rw-r--r--src/bin/test.c2
-rw-r--r--src/bin/test_scroller.c64
3 files changed, 103 insertions, 0 deletions
diff --git a/data/objects/test.edc b/data/objects/test.edc
index 74c90b6b1..84407e5ad 100644
--- a/data/objects/test.edc
+++ b/data/objects/test.edc
@@ -749,4 +749,41 @@ collections {
749 } 749 }
750 } 750 }
751 } 751 }
752group { name: "page_layout";
753 parts {
754 part { name: "bg";
755 type: RECT;
756 scale: 1;
757 description { state: "default" 0.0;
758 min: 400 500;
759 max: 400 500;
760 color: 0 0 0 0;
761 }
762 }
763 part { name: "page";
764 type: SWALLOW;
765 scale: 1;
766 description { state: "default" 0.0;
767 rel1.relative: 0.1 0.1;
768 rel1.to:"bg";
769 rel2.relative: 0.9 0.9;
770 rel2.to:"bg";
771 }
772 }
773 part { name: "text";
774 type: TEXT;
775 scale: 1;
776 description { state: "default" 0.0;
777 fixed: 1 1;
778 rel1.relative: 0.5 0.5;
779 rel2.relative: 0.5 0.5;
780 text {
781 min: 1 1;
782 size: 50;
783 ellipsis: -1;
784 }
785 }
786 }
787 }
788
752} 789}
diff --git a/src/bin/test.c b/src/bin/test.c
index e6479ff5f..8a82f1eec 100644
--- a/src/bin/test.c
+++ b/src/bin/test.c
@@ -152,6 +152,7 @@ void test_separator(void *data, Evas_Object *obj, void *event_info);
152void test_scroller(void *data, Evas_Object *obj, void *event_info); 152void test_scroller(void *data, Evas_Object *obj, void *event_info);
153void test_scroller2(void *data, Evas_Object *obj, void *event_info); 153void test_scroller2(void *data, Evas_Object *obj, void *event_info);
154void test_scroller3(void *data, Evas_Object *obj, void *event_info); 154void test_scroller3(void *data, Evas_Object *obj, void *event_info);
155void test_scroller4(void *data, Evas_Object *obj, void *event_info);
155void test_spinner(void *data, Evas_Object *obj, void *event_info); 156void test_spinner(void *data, Evas_Object *obj, void *event_info);
156void test_index(void *data, Evas_Object *obj, void *event_info); 157void test_index(void *data, Evas_Object *obj, void *event_info);
157void test_index2(void *data, Evas_Object *obj, void *event_info); 158void test_index2(void *data, Evas_Object *obj, void *event_info);
@@ -759,6 +760,7 @@ add_tests:
759 ADD_TEST(NULL, "Scroller", "Scroller", test_scroller); 760 ADD_TEST(NULL, "Scroller", "Scroller", test_scroller);
760 ADD_TEST(NULL, "Scroller", "Scroller 2", test_scroller2); 761 ADD_TEST(NULL, "Scroller", "Scroller 2", test_scroller2);
761 ADD_TEST(NULL, "Scroller", "Scroller 3", test_scroller3); 762 ADD_TEST(NULL, "Scroller", "Scroller 3", test_scroller3);
763 ADD_TEST(NULL, "Scroller", "Page Scroller", test_scroller4);
762 764
763 //------------------------------// 765 //------------------------------//
764 // FIXME: add frame test 766 // FIXME: add frame test
diff --git a/src/bin/test_scroller.c b/src/bin/test_scroller.c
index 3a53d1bd3..eb00f2594 100644
--- a/src/bin/test_scroller.c
+++ b/src/bin/test_scroller.c
@@ -664,3 +664,67 @@ test_scroller3(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
664 evas_object_resize(win, 500, 500); 664 evas_object_resize(win, 500, 500);
665 evas_object_show(win); 665 evas_object_show(win);
666} 666}
667
668void
669test_scroller4(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
670{
671 Evas_Object *win, *sc, *bx, *ly, *sc2, *rect, *rect2;
672 char buf[PATH_MAX];
673
674 win = elm_win_util_standard_add("scroller3", "Scroller 3");
675 elm_win_autodel_set(win, EINA_TRUE);
676
677 sc = elm_scroller_add(win);
678 elm_scroller_loop_set(sc, EINA_TRUE, EINA_FALSE);
679 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
680 elm_scroller_page_relative_set(sc, 1.0, 0.0);
681 elm_scroller_policy_set(sc, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
682 elm_scroller_page_scroll_limit_set(sc, 1, 0);
683 elm_win_resize_object_add(win, sc);
684 evas_object_show(sc);
685
686 bx = elm_box_add(sc);
687 elm_box_horizontal_set(bx, EINA_TRUE);
688 elm_object_content_set(sc, bx);
689 evas_object_show(bx);
690
691 ly = elm_layout_add(bx);
692 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
693 elm_layout_file_set(ly, buf, "page_layout");
694 elm_object_part_text_set(ly, "text", "Page1");
695 elm_box_pack_end(bx, ly);
696 evas_object_show(ly);
697
698 sc2 = elm_scroller_add(ly);
699 elm_object_part_content_set(ly, "page", sc2);
700 evas_object_show(sc2);
701
702 rect2 = evas_object_rectangle_add(evas_object_evas_get(sc2));
703 evas_object_color_set(rect2, 50, 0, 0, 50);
704 evas_object_size_hint_min_set(rect2, 0, 2000);
705 elm_object_content_set(sc2, rect2);
706 evas_object_show(rect2);
707
708 ly = elm_layout_add(bx);
709 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
710 elm_layout_file_set(ly, buf, "page_layout");
711 rect = evas_object_rectangle_add(evas_object_evas_get(ly));
712 evas_object_color_set(rect, 0, 50, 0, 50);
713 elm_object_part_content_set(ly, "page", rect);
714 elm_object_part_text_set(ly, "text", "Page2");
715 elm_box_pack_end(bx, ly);
716 evas_object_show(ly);
717
718 ly = elm_layout_add(bx);
719 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
720 elm_layout_file_set(ly, buf, "page_layout");
721 rect = evas_object_rectangle_add(evas_object_evas_get(ly));
722 evas_object_color_set(rect, 0, 0, 50, 50);
723 elm_object_part_content_set(ly, "page", rect);
724 elm_object_part_text_set(ly, "text", "Page3");
725 elm_box_pack_end(bx, ly);
726 evas_object_show(ly);
727
728 evas_object_resize(win, 400, 550);
729 evas_object_show(win);
730}