kuuko pushed a commit to branch master.

commit ef07c559878dcda786c0eb70ea79fdcd7ca67012
Author: Kai Huuhko <[email protected]>
Date:   Mon Apr 15 09:07:19 2013 +0000

    Elementary: Add two tests for Conformant.
---
 examples/elementary/test.py         |   5 +
 examples/elementary/test_conform.py | 233 ++++++++++++++++++++++++++++++++++++
 2 files changed, 238 insertions(+)

diff --git a/examples/elementary/test.py b/examples/elementary/test.py
index 2a8bdb7..545be1d 100755
--- a/examples/elementary/test.py
+++ b/examples/elementary/test.py
@@ -28,6 +28,7 @@ from test_check import check_clicked
 from test_clock import clock_clicked
 from test_colorselector import colorselector_clicked
 from test_config import config_clicked
+from test_conform import conformant_clicked, conformant2_clicked
 from test_core_evas_object_callbacks import core_evas_object_callbacks_clicked
 from test_core_evas_canvas_callbacks import core_evas_canvas_callbacks_clicked
 from test_core_evas_objects import core_evas_objects_clicked
@@ -202,6 +203,10 @@ items = [
             ("Radios", radio_clicked),
             ("Segment Control", segment_control_clicked),
         ]),
+         ("Standardization", [
+            ("Conformant", conformant_clicked),
+            ("Conformant 2", conformant2_clicked),
+        ]),
          ("Stored Surface Buffer", [
             ("Launcher", mapbuf_clicked),
         ]),
diff --git a/examples/elementary/test_conform.py 
b/examples/elementary/test_conform.py
new file mode 100644
index 0000000..f7557ec
--- /dev/null
+++ b/examples/elementary/test_conform.py
@@ -0,0 +1,233 @@
+from efl import elementary
+from efl.elementary.window import StandardWindow
+from efl.elementary.conformant import Conformant
+from efl.elementary.button import Button
+from efl.elementary.entry import Entry
+from efl.elementary.box import Box
+from efl.elementary.naviframe import Naviframe
+from efl.elementary.frame import Frame
+from efl.elementary.label import Label
+from efl.elementary.list import List
+
+from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
+
+def conformant_clicked(obj, item=None):
+    win = StandardWindow("conformant", "Conformant")
+    win.autodel = True
+    win.conformant = True
+
+    conform = Conformant(win)
+    conform.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+    win.resize_object_add(conform)
+    conform.show()
+
+    bx = Box(win)
+    bx.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+    bx.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
+
+    en = Entry(win)
+    en.scrollable = True
+    en.single_line = True
+    en.bounce = True, False
+    en.text = "This is the top entry here"
+    en.size_hint_weight = EVAS_HINT_EXPAND, 0.0
+    en.size_hint_align = EVAS_HINT_FILL, 0.5
+    en.show()
+    bx.pack_end(en)
+
+    btn = Button(win)
+    btn.text = "Test Conformant"
+    btn.size_hint_weight = EVAS_HINT_EXPAND, 0.0
+    btn.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
+    bx.pack_end(btn)
+    btn.show()
+
+    en = Entry(win)
+    en.scrollable = True
+    en.single_line = True
+    en.bounce = True, False
+    en.text = "This is the middle entry here"
+    en.size_hint_weight = EVAS_HINT_EXPAND, 0.0
+    en.size_hint_align = EVAS_HINT_FILL, 0.5
+    en.show()
+    bx.pack_end(en)
+
+    btn = Button(win)
+    btn.text = "Test Conformant"
+    btn.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+    btn.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
+    bx.pack_end(btn)
+    btn.show()
+
+    en = Entry(win)
+    en.scrollable = True
+    en.bounce = False, True
+    en.text = "This is a multi-line entry at the bottom<br/>" \
+    "This can contain more than 1 line of text and be " \
+    "scrolled around to allow for entering of lots of " \
+    "content. It is also to test to see that autoscroll " \
+    "moves to the right part of a larger multi-line " \
+    "text entry that is inside of a scroller than can be " \
+    "scrolled around, thus changing the expected position " \
+    "as well as cursor changes updating auto-scroll when " \
+    "it is enabled."
+    en.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+    en.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
+    en.show()
+    bx.pack_end(en)
+
+    conform.content = bx
+    bx.show()
+
+    win.size = 240, 240
+    win.show()
+
+def popobj(obj, *args, **kwargs):
+    nf = args[0]
+    nf.item_pop()
+
+def conformant2_clicked(obj, item=None):
+    win = StandardWindow("conformant2", "Conformant 2")
+    win.autodel = True
+    win.conformant = True
+
+    bx = Box(win)
+    bx.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+    win.resize_object_add(bx)
+    bx.show()
+
+    en = Entry(win)
+    en.scrollable = True
+    en.single_line = True
+    en.bounce = True, False
+    en.text = "This is the top entry here"
+    en.size_hint_weight = EVAS_HINT_EXPAND, 0.0
+    en.size_hint_align = EVAS_HINT_FILL, 0.5
+    bx.pack_end(en)
+    en.show()
+
+    btn = Button(win)
+    btn.focus_allow = False
+    btn.text = "Delete Below"
+    btn.size_hint_weight = EVAS_HINT_EXPAND, 0.0
+    btn.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
+    bx.pack_end(btn)
+    btn.show()
+
+    pg = Naviframe(win)
+    pg.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+    pg.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
+    bx.pack_end(pg)
+    pg.show()
+
+    btn.callback_clicked_add(popobj, pg)
+
+    conform = Conformant(win)
+    conform.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+    conform.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
+    pg.item_simple_push(conform)
+    conform.show()
+
+    bx = Box(win)
+    bx.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+    bx.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
+
+    en = Entry(win)
+    en.scrollable = True
+    en.bounce = False, True
+    en.text = "This entry and button below get deleted."
+    en.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+    en.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
+    en.show()
+    bx.pack_end(en)
+
+    btn = Button(win)
+    btn.focus_allow = False
+    btn.text = "Delete this bottom bit 1"
+    btn.size_hint_weight = EVAS_HINT_EXPAND, 0.0
+    btn.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
+    bx.pack_end(btn)
+    btn.show()
+
+    btn.callback_clicked_add(popobj, pg)
+
+    conform.content = bx
+    bx.show()
+
+    conform = Conformant(win)
+    conform.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+    conform.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
+    pg.item_simple_push(conform)
+    conform.show()
+
+    bx = Box(win)
+    bx.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+    bx.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
+
+    en = Entry(win)
+    en.scrollable = True
+    en.bounce = False, True
+    en.text = "This entry and button below get deleted."
+    en.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+    en.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
+    en.show()
+    bx.pack_end(en)
+
+    btn = Button(win)
+    btn.focus_allow = False
+    btn.text = "Delete this bottom bit 2"
+    btn.size_hint_weight = EVAS_HINT_EXPAND, 0.0
+    btn.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
+    bx.pack_end(btn)
+    btn.show()
+
+    btn.callback_clicked_add(popobj, pg)
+
+    conform.content = bx
+    bx.show()
+
+    win.size = 240, 480
+    win.show()
+
+if __name__ == "__main__":
+    elementary.init()
+    win = StandardWindow("test", "python-elementary test application")
+    win.callback_delete_request_add(lambda o: elementary.exit())
+
+    box0 = Box(win)
+    box0.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
+    win.resize_object_add(box0)
+    box0.show()
+
+    fr = Frame(win)
+    fr.text = "Information"
+    box0.pack_end(fr)
+    fr.show()
+
+    lb = Label(win)
+    lb.text = "Please select a test from the list below<br>" \
+                "by clicking the test button to show the<br>" \
+                "test window."
+    fr.content_set(lb)
+    lb.show()
+
+    items = [
+        ("Conformant", conformant_clicked),
+        ("Conformant 2", conformant2_clicked),
+    ]
+
+    li = List(win)
+    li.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
+    li.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL)
+    box0.pack_end(li)
+    li.show()
+
+    for item in items:
+        li.item_append(item[0], callback=item[1])
+
+    li.go()
+
+    win.resize(320,520)
+    win.show()
+    elementary.run()
+    elementary.shutdown()

-- 

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter

Reply via email to