summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-04-23 10:21:43 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-04-24 15:52:48 +0200
commit2e85c6ba344852242290bac55621a9d0e6e0829f (patch)
tree84085ef85b6015fc85038ef63c2e924a1ea080ad
parente9c49d0f70e9052ff40968ecfb43d89442a65aec (diff)
efl_ui_spec_suite: move the information about tests to the test files
for now the widgets which are tested are encoded in the test files where the tests are implemented. This is for now done in a simple json format, just for the sake of simplicity. ref T7815 Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D8685
-rw-r--r--src/tests/elementary/spec/efl_test_content.c9
-rw-r--r--src/tests/elementary/spec/efl_test_pack.c6
-rw-r--r--src/tests/elementary/spec/efl_test_pack_linear.c5
-rwxr-xr-xsrc/tests/elementary/spec/generator.py30
-rw-r--r--src/tests/elementary/spec/meson.build17
5 files changed, 49 insertions, 18 deletions
diff --git a/src/tests/elementary/spec/efl_test_content.c b/src/tests/elementary/spec/efl_test_content.c
index e0652b6e02..1231d7096f 100644
--- a/src/tests/elementary/spec/efl_test_content.c
+++ b/src/tests/elementary/spec/efl_test_content.c
@@ -6,6 +6,15 @@
6#include "efl_ui_spec_suite.h" 6#include "efl_ui_spec_suite.h"
7#include "suite_helpers.h" 7#include "suite_helpers.h"
8 8
9/* spec-meta-start
10 {"test-interface":"Efl.Content",
11 "test-widgets": ["Efl.Ui.Button", "Efl.Ui.Frame", "Efl.Ui.Grid_Default_Item",
12 "Efl.Ui.List_Default_Item", "Efl.Ui.List_Empty_Item",
13 "Efl.Ui.Navigation_Layout", "Efl.Ui.Panel", "Efl.Ui.Progressbar",
14 "Efl.Ui.Radio", "Efl.Ui.Popup", "Efl.Ui.Tab_Page", "Efl.Ui.Scroller"]}
15
16 spec-meta-end */
17
9EFL_START_TEST(content_set_get) 18EFL_START_TEST(content_set_get)
10{ 19{
11 Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win); 20 Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
diff --git a/src/tests/elementary/spec/efl_test_pack.c b/src/tests/elementary/spec/efl_test_pack.c
index 626e3e9b5b..61b3bafa57 100644
--- a/src/tests/elementary/spec/efl_test_pack.c
+++ b/src/tests/elementary/spec/efl_test_pack.c
@@ -6,6 +6,12 @@
6#include "efl_ui_spec_suite.h" 6#include "efl_ui_spec_suite.h"
7#include "suite_helpers.h" 7#include "suite_helpers.h"
8 8
9/* spec-meta-start
10 {"test-interface":"Efl.Pack",
11 "test-widgets": ["Efl.Ui.Table"]}
12
13 spec-meta-end */
14
9/* 15/*
10 In general: 16 In general:
11 - If a subobject is deleted the box simply forgets about it. Never return this element again container. 17 - If a subobject is deleted the box simply forgets about it. Never return this element again container.
diff --git a/src/tests/elementary/spec/efl_test_pack_linear.c b/src/tests/elementary/spec/efl_test_pack_linear.c
index cf85f9192b..31647fa0b2 100644
--- a/src/tests/elementary/spec/efl_test_pack_linear.c
+++ b/src/tests/elementary/spec/efl_test_pack_linear.c
@@ -7,6 +7,11 @@
7#include "suite_helpers.h" 7#include "suite_helpers.h"
8#include <limits.h> 8#include <limits.h>
9 9
10/* spec-meta-start
11 {"test-interface":"Efl.Pack_Linear",
12 "test-widgets": ["Efl.Ui.Box"]}
13 spec-meta-end */
14
10static void 15static void
11_fill_array(Efl_Ui_Widget *wid[3]) 16_fill_array(Efl_Ui_Widget *wid[3])
12{ 17{
diff --git a/src/tests/elementary/spec/generator.py b/src/tests/elementary/spec/generator.py
index 3a84b01862..c6f73edce2 100755
--- a/src/tests/elementary/spec/generator.py
+++ b/src/tests/elementary/spec/generator.py
@@ -1,14 +1,5 @@
1#!/usr/bin/python 1#!/usr/bin/python
2 2
3tests = [
4 ["Efl.Pack_Linear" , "Efl.Ui.Box"],
5 ["Efl.Pack" , "Efl.Ui.Table"],
6 ["Efl.Content" , "Efl.Ui.Button", "Efl.Ui.Frame", "Efl.Ui.Grid_Default_Item",
7 "Efl.Ui.List_Default_Item", "Efl.Ui.List_Empty_Item",
8 "Efl.Ui.Navigation_Layout", "Efl.Ui.Panel", "Efl.Ui.Progressbar",
9 "Efl.Ui.Radio", "Efl.Ui.Popup", "Efl.Ui.Tab_Page", "Efl.Ui.Scroller"]
10]
11
12fixture_gen_template = """ 3fixture_gen_template = """
13static void 4static void
14_{}_fixture(void) 5_{}_fixture(void)
@@ -37,7 +28,10 @@ file_gen_template = """
37""" 28"""
38 29
39import sys 30import sys
31import json
40 32
33output_file = sys.argv[-1]
34input_files = sys.argv[1:-1]
41list_of_tcases = "static const Efl_Test_Case etc[] = {\n" 35list_of_tcases = "static const Efl_Test_Case etc[] = {\n"
42list_entry = " {{ \"{}-{}\", {}}},\n" 36list_entry = " {{ \"{}-{}\", {}}},\n"
43generated_api = "" 37generated_api = ""
@@ -51,11 +45,23 @@ def to_func_name(class_name):
51def to_class_getter(class_name): 45def to_class_getter(class_name):
52 return class_name.replace('.','_').upper()+'_CLASS' 46 return class_name.replace('.','_').upper()+'_CLASS'
53 47
48tests = []
49
50for input_file in input_files:
51 with open(input_file, 'r') as content_file:
52 content = content_file.read()
53 start = content.index('spec-meta-start') + len('spec-meta-start')
54 end = content.index('spec-meta-end')
55 resulting_json = content[start:end]
56 tmp = json.loads(resulting_json)
57 if "test-interface" in tmp and "test-widgets" in tmp:
58 tests.append(tmp)
59
54widgets = [] 60widgets = []
55 61
56for test in tests: 62for test in tests:
57 interface_test = to_func_name(test[0]) 63 interface_test = to_func_name(test["test-interface"])
58 for widget_class in test[1:]: 64 for widget_class in test["test-widgets"]:
59 combo_name = "_{}_{}".format(to_func_name(interface_test), to_func_name(widget_class)); 65 combo_name = "_{}_{}".format(to_func_name(interface_test), to_func_name(widget_class));
60 list_of_tcases += list_entry.format(interface_test, to_func_name(widget_class), combo_name) 66 list_of_tcases += list_entry.format(interface_test, to_func_name(widget_class), combo_name)
61 generated_api += tcase_gen_template.format(combo_name, to_func_name(widget_class), interface_to_api(interface_test)) 67 generated_api += tcase_gen_template.format(combo_name, to_func_name(widget_class), interface_to_api(interface_test))
@@ -67,5 +73,5 @@ for widget in widgets:
67 73
68list_of_tcases += " { NULL, NULL }\n};" 74list_of_tcases += " { NULL, NULL }\n};"
69 75
70output = open(sys.argv[1], "w") 76output = open(output_file, "w")
71output.write(file_gen_template.format(list_of_tcases, generated_api)) 77output.write(file_gen_template.format(list_of_tcases, generated_api))
diff --git a/src/tests/elementary/spec/meson.build b/src/tests/elementary/spec/meson.build
index 7f87d8e8e4..6dfa87c1bd 100644
--- a/src/tests/elementary/spec/meson.build
+++ b/src/tests/elementary/spec/meson.build
@@ -1,19 +1,24 @@
1efl_ui_suite_behavior_src = [ 1
2efl_ui_suite_behavior_test_files = files([
3 'efl_test_pack.c',
4 'efl_test_pack_linear.c',
5 'efl_test_content.c',
6])
7
8efl_ui_suite_behavior_src = files([
2 join_paths('..','suite_helpers.c'), 9 join_paths('..','suite_helpers.c'),
3 join_paths('..','suite_helpers.h'), 10 join_paths('..','suite_helpers.h'),
4 join_paths('..','elm_test_init.c'), 11 join_paths('..','elm_test_init.c'),
5 'efl_ui_spec_suite.c', 12 'efl_ui_spec_suite.c',
6 'efl_test_pack.c',
7 'efl_test_pack_linear.c',
8 'efl_test_container.c', 13 'efl_test_container.c',
9 'efl_test_content.c', 14]) + efl_ui_suite_behavior_test_files
10]
11 15
12test_generator = find_program('generator.py') 16test_generator = find_program('generator.py')
13 17
14generated_test_parts = custom_target('generate_test_suite', 18generated_test_parts = custom_target('generate_test_suite',
19 input: efl_ui_suite_behavior_test_files,
15 output: 'efl_ui_spec_suite_gen.x', 20 output: 'efl_ui_spec_suite_gen.x',
16 command: [test_generator, '@OUTPUT@'], 21 command: [test_generator, '@INPUT@', '@OUTPUT@'],
17) 22)
18 23
19efl_ui_behavior_suite = executable('efl_ui_spec_suite', 24efl_ui_behavior_suite = executable('efl_ui_spec_suite',