Add test and checker to widget items
authorTiago Rezende Campos Falcao <developer@tiagofalcao.com>
Tue, 2 Nov 2010 11:26:44 +0000 (11:26 +0000)
committerTiago Rezende Campos Falcao <developer@tiagofalcao.com>
Tue, 2 Nov 2010 11:26:44 +0000 (11:26 +0000)
SVN revision: 54089

src/lib/elm_widget.h
tests/test_decl.sh

index 7e621f7..526b4d4 100644 (file)
@@ -471,6 +471,14 @@ EAPI void             elm_widget_tree_dot_dump(const Evas_Object *top, FILE *out
 #define ELM_CHECK_WIDTYPE(obj, widtype) \
    if (!elm_widget_type_check((obj), (widtype))) return
 
+#define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, ...)                \
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN((Elm_Widget_Item *)it, __VA_ARGS__); \
+   ELM_CHECK_WIDTYPE(it->base.widget, widtype) __VA_ARGS__;
+
+#define ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, label)                \
+   ELM_WIDGET_ITEM_CHECK_OR_GOTO((Elm_Widget_Item *)it, label);         \
+   if (!elm_widget_type_check((it->base.widget), (widtype))) goto label;
+
 
 /**
  * The drag and drop API.
index c317f50..ca86eba 100755 (executable)
@@ -24,36 +24,62 @@ check(){
     fi
 
     func=$(echo $i | grep -oe 'elm_\w\+')
+    ass=$(sed '2q;d' eapi.decl)
 
-    sed '2q;d' eapi.decl | grep -qe "elm_widget\w\+(\(const \)\?Evas_Object \*"
+    echo $i | grep -qe "^elm_object"
     if [ $? == 0 ];then
-        tail -n9 eapi.decl | grep -q "\(API_ENTRY\|_elm_widget_is\)"
-        if [ $? != 0 ];then
-            echo -e "\e[31;1mMISSING CHECKER\e[m\t $i"
-            ret=1
-        fi
+        rm eapi.decl
         return
     fi
 
-    sed '2q;d' eapi.decl | grep -qe "elm_object_\w\+("
+    echo $i | grep -qe "^elm_widget"
     if [ $? == 0 ];then
-        rm eapi.decl
-        return
+
+        echo $ass | grep -qe "elm_widget\w\+(\(const \)\?Evas_Object \*"
+        if [ $? == 0 ];then
+            tail -n9 eapi.decl | grep -q "\(API_ENTRY\|_elm_widget_is\)"
+            if [ $? != 0 ];then
+                echo -e "\e[31;1mMISSING CHECKER\e[m\t $i"
+                ret=1
+            fi
+            return
+        fi
+
+        echo $ass | grep -qe "elm_widget\w\+(\(const \)\?Elm_ \*"
+        if [ $? == 0 ];then
+            tail -n9 eapi.decl | grep -qe "ELM_WIDGET_ITEM_CHECK"
+            if [ $? != 0 ];then
+                echo -e "\e[31;1mMISSING CHECKER\e[m\t $i"
+                ret=1
+            fi
+            return
+        fi
     fi
 
-    sed '2q;d' eapi.decl | grep -qe "elm_\w\+_add("
+    echo $ass | grep -qe "elm_\w\+_add"
     if [ $? == 0 ];then
-        rm eapi.decl
+        echo -e "\e[32;1m???\e[m\t $i"
         return
     fi
 
-    sed '2q;d' eapi.decl | grep -qe "elm_\w\+(\(const \)\?Evas_Object \*"
+    echo $ass | grep -qe "elm_\w\+(\(const \)\?Evas_Object \*"
     if [ $? == 0 ];then
         tail -n9 eapi.decl | grep -q "ELM_CHECK_WIDTYPE"
         if [ $? != 0 ];then
             echo -e "\e[31;1mMISSING CHECKER\e[m\t $i"
             ret=1
         fi
+        return
+    fi
+
+    echo $ass | grep -qe "elm_\w\+(\(const \)\?Elm_\w\+_Item \*"
+    if [ $? == 0 ];then
+        tail -n9 eapi.decl | grep -qe "ELM_\w\+_ITEM_.*CHECK"
+        if [ $? != 0 ];then
+            echo -e "\e[31;1mMISSING CHECKER\e[m\t $i"
+            ret=1
+        fi
+        return
     fi
 
     rm eapi.decl
@@ -62,13 +88,7 @@ check(){
 grep -e "^ *EAPI.*(.*)" src/lib/Elementary.h.in | grep -oe 'elm_\w\+' >eapi.list
 
 for i in $(cat eapi.list); do
-    check $i $(ls -1 src/lib/*.c | grep -v elm_widget | grep -v els_cursor)
-done
-
-grep -e "^ *EAPI.*(.*)" src/lib/Elementary_Cursor.h | grep -oe 'elm_\w\+' >eapi.list
-
-for i in $(cat eapi.list); do
-    check $i src/lib/els_cursor.c src/lib/elm_main.c
+    check $i $(ls -1 src/lib/*.c | grep -v elm_widget)
 done
 
 grep -e "^ *EAPI.*(.*)" src/lib/elm_widget.h | grep -oe '_\?elm_\w\+' >eapi.list