Enlightenment CVS committal

Author  : jethomas
Project : e17
Module  : libs/ewl

Dir     : e17/libs/ewl/src/bin/tests/kinetic_scrollpane


Modified Files:
        ewl_kinetic_scrollpane_test.c 


Log Message:
Add unit tests and fixes for kinetic scrollpane.

===================================================================
RCS file: 
/cvs/e/e17/libs/ewl/src/bin/tests/kinetic_scrollpane/ewl_kinetic_scrollpane_test.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- ewl_kinetic_scrollpane_test.c       7 Feb 2008 20:15:30 -0000       1.2
+++ ewl_kinetic_scrollpane_test.c       11 Feb 2008 22:00:01 -0000      1.3
@@ -13,6 +13,22 @@
 static int create_test(Ewl_Container *box);
 static void destroy_test(Ewl_Widget *w, void *ev, void *data);
 
+/* unit tests */
+static int scroll_type_get(char *buf, int len);
+static int kinetic_dampen_get(char *buf, int len);
+static int kinetic_vmax_get(char *buf, int len);
+static int kinetic_vmin_get(char *buf, int len);
+static int kinetic_fps_get(char *buf, int len);
+
+static Ewl_Unit_Test kinetic_tree_unit_tests[] = {
+       {"get type of scrolling", scroll_type_get, NULL, -1, 0},
+       {"get kinetic dampning", kinetic_dampen_get, NULL, -1, 0},
+       {"get maximum kinetic velocity", kinetic_vmax_get, NULL, -1, 0},
+       {"get minimum kinetic velocity", kinetic_vmin_get, NULL, -1, 0},
+       {"get kinetic fps", kinetic_fps_get, NULL, -1, 0},
+       {NULL, NULL, NULL, -1, 0}
+};
+
 void
 test_info(Ewl_Test *test)
 {
@@ -21,6 +37,7 @@
        test->filename = __FILE__;
        test->func = create_test;
        test->type = EWL_TEST_TYPE_CONTAINER;
+       test->unit_tests = kinetic_tree_unit_tests;
 }
 
 static void destroy_test(Ewl_Widget *w, void *ev, void *data)
@@ -92,3 +109,118 @@
 
        return 1;
 }
+
+static int
+scroll_type_get(char *buf, int len)
+{
+       Ewl_Widget *tree;
+       Ewl_Kinetic_Scroll type;
+       int ret = 1;
+
+       tree = ewl_tree_new();
+       ewl_tree_kinetic_scrolling_set(EWL_TREE(tree),
+                                               EWL_KINETIC_SCROLL_NORMAL);
+       type = ewl_tree_kinetic_scrolling_get(EWL_TREE(tree));
+
+       if (type != EWL_KINETIC_SCROLL_NORMAL)
+       {
+               LOG_FAILURE(buf, len, "get type is different from the set one");
+               ret = 0;
+       }
+
+       ewl_widget_destroy(tree);
+
+       return ret;
+}
+
+static int
+kinetic_dampen_get(char *buf, int len)
+{
+       Ewl_Widget *tree;
+       double val, set;
+       int ret = 1;
+
+       set = 0.06;
+       tree = ewl_tree_new();
+       ewl_tree_kinetic_dampen_set(EWL_TREE(tree), set);
+       val = ewl_tree_kinetic_dampen_get(EWL_TREE(tree));
+
+       if (val != set)
+       {
+               LOG_FAILURE(buf, len, "get dampen is different from the set 
dampen");
+               ret = 0;
+       }
+       
+       ewl_widget_destroy(tree);
+
+       return ret;
+}
+
+static int
+kinetic_vmax_get(char *buf, int len)
+{
+       Ewl_Widget *tree;
+       double val, set;
+       int ret = 1;
+
+       set = 27;
+       tree = ewl_tree_new();
+       ewl_tree_kinetic_max_velocity_set(EWL_TREE(tree), set);
+       val = ewl_tree_kinetic_max_velocity_get(EWL_TREE(tree));
+
+       if (val != set)
+       {
+               LOG_FAILURE(buf, len, "get vmax is different from the set 
vmax");
+               ret = 0;
+       }
+
+       ewl_widget_destroy(tree);
+
+       return ret;
+}
+
+static int
+kinetic_vmin_get(char *buf, int len)
+{
+       Ewl_Widget *tree;
+       double val, set;
+       int ret = 1;
+
+       set = 13;
+       tree = ewl_tree_new();
+       ewl_tree_kinetic_min_velocity_set(EWL_TREE(tree), set);
+       val = ewl_tree_kinetic_min_velocity_get(EWL_TREE(tree));
+
+       if (val != set)
+       {
+               LOG_FAILURE(buf, len, "get vmin is different from the set 
vmin");
+               ret = 0;
+       }
+
+       ewl_widget_destroy(tree);
+
+       return ret;
+}
+
+static int
+kinetic_fps_get(char *buf, int len)
+{
+       Ewl_Widget *tree;
+       int val;
+       int ret = 1;
+
+       tree = ewl_tree_new();
+       ewl_tree_kinetic_fps_set(EWL_TREE(tree), 3);
+       val = ewl_tree_kinetic_fps_get(EWL_TREE(tree));
+
+       if (val != 3)
+       {
+               LOG_FAILURE(buf, len, "get fps is different from the set fps");
+               ret = 0;
+       }
+
+       ewl_widget_destroy(tree);
+
+       return ret;
+}
+



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to