summaryrefslogtreecommitdiff
path: root/src/tests/elementary/elm_test_config.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-06-21 17:54:56 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-06-24 16:57:04 +0900
commit47a1fae200c824672c06c6b63a098dc54af033a4 (patch)
tree530596e24977f3780a213b2af34fffe1d437724c /src/tests/elementary/elm_test_config.c
parente1d5d5e4a1817e148e51a8e1ae15969f826f4b1d (diff)
efl: Introduce general Efl.Config API
This is to port elm_config to EO APIs. The current implementation relies on the legacy API, by simply forwarding calls. The new API is simply efl_config_set("config_name", value) where value is an Eina_Value (aka. generic_value). The C interface proposes a few helpers like config_int_set, config_double_set, etc... Unfortunately at the moment, not all config options are supported, as some rely on more complex types: - lists - color class and multiple arguments - unset functions - enums Profiles are also not handled at this point. @feature
Diffstat (limited to '')
-rw-r--r--src/tests/elementary/elm_test_config.c120
1 files changed, 120 insertions, 0 deletions
diff --git a/src/tests/elementary/elm_test_config.c b/src/tests/elementary/elm_test_config.c
new file mode 100644
index 0000000..ed9745c
--- /dev/null
+++ b/src/tests/elementary/elm_test_config.c
@@ -0,0 +1,120 @@
1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h"
3#endif
4
5#define ELM_INTERFACE_ATSPI_ACCESSIBLE_PROTECTED
6#include <Elementary.h>
7#include "elm_suite.h"
8
9#include <stdbool.h>
10typedef unsigned int uint;
11
12START_TEST (elm_config_eoapi)
13{
14 elm_init(1, NULL);
15
16 Eo *cfg = efl_config_global_get(EFL_CONFIG_MIXIN);
17 fail_if(!cfg);
18
19#define CONFIG_CHK(opt, typ, val) do { \
20 typ old = elm_config_ ## opt ## _get(); \
21 fail_if(old != efl_config_ ## typ ## _get(cfg, #opt)); \
22 fail_if(!efl_config_ ## typ ## _set(cfg, #opt, val)); \
23 fail_if(elm_config_ ## opt ## _get() != val); \
24 fail_if(efl_config_ ## typ ## _get(cfg, #opt) != val); \
25 } while (0)
26
27#define CONFIG_CHKB(opt, val) CONFIG_CHK(opt, bool, val)
28#define CONFIG_CHKI(opt, val) CONFIG_CHK(opt, int, val)
29#define CONFIG_CHKU(opt, val) CONFIG_CHK(opt, uint, val)
30#define CONFIG_CHKD(opt, val) CONFIG_CHK(opt, double, val)
31
32 // note: leaks badly
33#define CONFIG_CHKS(opt, val) do { \
34 const char *old = elm_config_ ## opt ## _get(); \
35 fail_if(!eina_streq(old, efl_config_string_get(cfg, #opt))); \
36 fail_if(!efl_config_string_set(cfg, #opt, val)); \
37 fail_if(!eina_streq(elm_config_ ## opt ## _get(), val)); \
38 fail_if(!eina_streq(efl_config_string_get(cfg, #opt), val)); \
39 } while (0)
40
41 CONFIG_CHKB(scroll_bounce_enabled, !old);
42 CONFIG_CHKD(scroll_bounce_friction, 0);
43 CONFIG_CHKD(scroll_page_scroll_friction, 0);
44 CONFIG_CHKB(context_menu_disabled, !old);
45 CONFIG_CHKD(scroll_bring_in_scroll_friction, 0);
46 CONFIG_CHKD(scroll_zoom_friction, 0);
47 CONFIG_CHKB(scroll_thumbscroll_enabled, !old);
48 CONFIG_CHKU(scroll_thumbscroll_threshold, 0);
49 CONFIG_CHKU(scroll_thumbscroll_hold_threshold, 0);
50 CONFIG_CHKD(scroll_thumbscroll_momentum_threshold, 0);
51 CONFIG_CHKU(scroll_thumbscroll_flick_distance_tolerance, 0);
52 CONFIG_CHKD(scroll_thumbscroll_friction, 0);
53 CONFIG_CHKD(scroll_thumbscroll_min_friction, 0);
54 CONFIG_CHKD(scroll_thumbscroll_friction_standard, 0);
55 CONFIG_CHKD(scroll_thumbscroll_border_friction, 0);
56 CONFIG_CHKD(scroll_thumbscroll_sensitivity_friction, 1.0);
57 CONFIG_CHKB(scroll_thumbscroll_smooth_start, 0);
58 CONFIG_CHKB(scroll_animation_disable, 0);
59 CONFIG_CHKD(scroll_accel_factor, 0);
60 CONFIG_CHKD(scroll_thumbscroll_smooth_amount, 0);
61 CONFIG_CHKD(scroll_thumbscroll_smooth_time_window, 0);
62 CONFIG_CHKD(scroll_thumbscroll_acceleration_threshold, 0);
63 CONFIG_CHKD(scroll_thumbscroll_acceleration_time_limit, 0);
64 CONFIG_CHKD(scroll_thumbscroll_acceleration_weight, 0);
65 //focus_autoscroll_mode
66 //slider_indicator_visible_mode
67 CONFIG_CHKD(longpress_timeout, 0);
68 //softcursor_mode
69 CONFIG_CHKD(tooltip_delay, 0);
70 CONFIG_CHKB(cursor_engine_only, 0);
71 CONFIG_CHKD(scale, 0);
72 CONFIG_CHKS(icon_theme, ELM_CONFIG_ICON_THEME_ELEMENTARY);
73 CONFIG_CHKB(password_show_last, 0);
74 CONFIG_CHKD(password_show_last_timeout, 0);
75 CONFIG_CHKS(preferred_engine, 0);
76 CONFIG_CHKS(accel_preference, 0);
77 //font_overlay
78 CONFIG_CHKB(access, 0);
79 CONFIG_CHKB(selection_unfocused_clear, 0);
80 //elm_config_font_overlay_unset
81 //CONFIG_CHKI(font_hint_type, 0); // this has no get!
82 CONFIG_CHKI(finger_size, 0);
83 CONFIG_CHKI(cache_flush_interval, 10);
84 CONFIG_CHKB(cache_flush_enabled, !old);
85 CONFIG_CHKI(cache_font_cache_size, 0);
86 CONFIG_CHKI(cache_image_cache_size, 0);
87 CONFIG_CHKI(cache_edje_file_cache_size, 0);
88 CONFIG_CHKI(cache_edje_collection_cache_size, 0);
89 CONFIG_CHKB(vsync, 0);
90 CONFIG_CHKB(accel_preference_override, 0);
91 CONFIG_CHKB(focus_highlight_enabled, !old);
92 CONFIG_CHKB(focus_highlight_animate, 0);
93 CONFIG_CHKB(focus_highlight_clip_disabled, !old);
94 //focus_move_policy
95 CONFIG_CHKB(item_select_on_focus_disabled, !old);
96 CONFIG_CHKB(first_item_focus_on_first_focusin, 0);
97 CONFIG_CHKB(mirrored, 0);
98 CONFIG_CHKB(clouseau_enabled, !old);
99 CONFIG_CHKD(glayer_long_tap_start_timeout, 0);
100 CONFIG_CHKD(glayer_double_tap_timeout, 0);
101 //color_overlay
102 //color_overlay_unset
103 CONFIG_CHKB(magnifier_enable, 0);
104 CONFIG_CHKD(magnifier_scale, 0);
105 //audio_mute
106 CONFIG_CHKB(window_auto_focus_enable, 0);
107 CONFIG_CHKB(window_auto_focus_animate, 0);
108 CONFIG_CHKB(popup_scrollable, 0);
109 CONFIG_CHKB(atspi_mode, 0);
110 CONFIG_CHKD(transition_duration_factor, 0);
111 CONFIG_CHKS(web_backend, old); // no value change (requires web support)
112
113 elm_shutdown();
114}
115END_TEST
116
117void elm_test_config(TCase *tc)
118{
119 tcase_add_test(tc, elm_config_eoapi);
120}