diff options
author | jk7744.park <jk7744.park@samsung.com> | 2016-02-24 18:38:03 +0900 |
---|---|---|
committer | jk7744.park <jk7744.park@samsung.com> | 2016-02-24 18:38:03 +0900 |
commit | 54c3ae4c54599a317323e04e4074a25c19f80ff3 (patch) | |
tree | cc3576906db51618e500db2366cc2154135c78fc | |
parent | 35e34a39231c313a9057aa1afc6ee875e50d185c (diff) | |
download | screen-reader-tizen_2.4.tar.gz screen-reader-tizen_2.4.tar.bz2 screen-reader-tizen_2.4.zip |
Tizen 2.4.0 rev3 SDK Public Releasetizen_2.4
-rwxr-xr-x | CMakeLists.txt | 1 | ||||
-rw-r--r-- | include/dbg.h | 39 | ||||
-rw-r--r-- | include/flat_navi.h | 57 | ||||
-rw-r--r-- | include/logger.h | 23 | ||||
-rwxr-xr-x | org.tizen.screen-reader.xml | 4 | ||||
-rwxr-xr-x | packaging/org.tizen.screen-reader.spec | 5 | ||||
-rw-r--r-- | res/po/en_US.po | 7 | ||||
-rw-r--r-- | src/flat_navi.c | 57 | ||||
-rw-r--r-- | src/keyboard_tracker.c | 2 | ||||
-rw-r--r-- | src/logger.c | 46 | ||||
-rw-r--r-- | src/main.c | 48 | ||||
-rw-r--r-- | src/navigator.c | 276 | ||||
-rw-r--r-- | src/screen_reader_spi.c | 11 | ||||
-rw-r--r-- | src/screen_reader_system.c | 2 | ||||
-rw-r--r-- | src/screen_reader_tts.c | 6 | ||||
-rw-r--r-- | src/screen_reader_vconf.c | 3 | ||||
-rw-r--r-- | src/smart_notification.c | 2 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 2 | ||||
-rw-r--r-- | tests/atspi/atspi.c | 13 | ||||
-rw-r--r-- | tests/smart_navi_suite.c | 95 |
20 files changed, 370 insertions, 329 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 20a7467..650c47c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,6 @@ pkg_check_modules(pkgs REQUIRED capi-network-bluetooth notification capi-network-wifi - capi-appfw-service-application ${TAPI_REQUIRED_PKG} ) diff --git a/include/dbg.h b/include/dbg.h new file mode 100644 index 0000000..3a0ed7c --- /dev/null +++ b/include/dbg.h @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __DBG_H__ + +#include <dlog.h> + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "org.tizen.clientDBusWrapper" + +#ifndef _ERR +#define _ERR(fmt, args...) LOGE("[%s:%d] "fmt"\n", __func__, __LINE__, ##args) +#endif + +#ifndef _DBG +#define _DBG(fmt, args...) LOGD("[%s:%d] "fmt"\n", __func__, __LINE__, ##args) +#endif + +#ifndef _INFO +#define _INFO(fmt, args...) LOGI("[%s:%d] "fmt"\n", __func__, __LINE__, ##args) +#endif + + +#endif /* __DBG_H__ */ diff --git a/include/flat_navi.h b/include/flat_navi.h index 0b1e49d..4aa097e 100644 --- a/include/flat_navi.h +++ b/include/flat_navi.h @@ -106,6 +106,54 @@ AtspiAccessible *flat_navi_context_current_get(FlatNaviContext *ctx); Eina_Bool flat_navi_context_current_set(FlatNaviContext *ctx, AtspiAccessible *target); /** + * Advances to previous line in natural reading order and returns + * new current element. + * + * @param ctx FlatNaviContext + * + * @return AtspiAccessible* pointer to current object + * + * @note If current line is first one, function returns NULL + * @note current element will be first of line. + */ +AtspiAccessible *flat_navi_context_line_prev(FlatNaviContext *ctx); + +/** + * Advances to next line in natural reading order and returns + * new current element. + * + * @param ctx FlatNaviContext + * + * @return AtspiAccessible* pointer to current object + * + * @note If current line is last one, function returns NULL + * @note current element will be first of line. + */ +AtspiAccessible *flat_navi_context_line_next(FlatNaviContext *ctx); + +/** + * Advances to first line. + * + * @param ctx FlatNaviContext + * + * @return AtspiAccessible* pointer to current object + * + * @note current element will be first of line. + */ +AtspiAccessible *flat_navi_context_line_first(FlatNaviContext *ctx); + +/** + * Advances to last line. + * + * @param ctx FlatNaviContext + * + * @return AtspiAccessible* pointer to current object + * + * @note current element will be first of line. + */ +AtspiAccessible *flat_navi_context_line_last(FlatNaviContext *ctx); + +/** * Set current context at given position. * * @param ctx FlatNaviContext @@ -123,6 +171,15 @@ Eina_Bool flat_navi_context_current_set(FlatNaviContext *ctx, AtspiAccessible *t Eina_Bool flat_navi_context_current_at_x_y_set( FlatNaviContext *ctx, gint x_cord, gint y_cord , AtspiAccessible **obj); /** + * Give the number of visible items in context. + * + * @param ctx FlatNaviContext + * + * @return int number of visible items in context + */ +int flat_navi_context_current_children_count_visible_get( FlatNaviContext *ctx); + +/** * Returns the first item in context; * @param ctx FlatNaviContext * @return Pointer to the first item in context diff --git a/include/logger.h b/include/logger.h index f9d6a0d..a4af526 100644 --- a/include/logger.h +++ b/include/logger.h @@ -1,19 +1,18 @@ #ifndef LOGGER_H_ #define LOGGER_H_ -#define TIZEN_ENGINEER_MODE -#include <libintl.h> -#include <dlog.h> +#include <Eina.h> +#include <Elementary.h> -#ifdef LOG_TAG -#undef LOG_TAG -#endif -#define LOG_TAG "SCREEN-READER" +extern int _eina_log_dom; + +int logger_init(void); +void logger_shutdown(void); -#define INFO(format, arg...) LOGI(format, ##arg) -#define DEBUG(format, arg...) LOGD(format, ##arg) -#define ERROR(format, arg...) LOGE(format, ##arg) -#define WARNING(format, arg...) LOGW(format, ##arg) +#define INFO(...) EINA_LOG_DOM_INFO(_eina_log_dom, __VA_ARGS__); +#define DEBUG(...) EINA_LOG_DOM_DBG(_eina_log_dom, __VA_ARGS__); +#define ERROR(...) EINA_LOG_DOM_ERR(_eina_log_dom, __VA_ARGS__); +#define WARNING(...) EINA_LOG_DOM_WARN(_eina_log_dom, __VA_ARGS__); #define MEMORY_ERROR "Memory allocation error" @@ -21,6 +20,6 @@ #undef _ #endif -#define _(str) (gettext(str)) +#define _(str) gettext(str) #endif /* end of include guard: LOGGER_H_ */ diff --git a/org.tizen.screen-reader.xml b/org.tizen.screen-reader.xml index 10932c6..f13fa26 100755 --- a/org.tizen.screen-reader.xml +++ b/org.tizen.screen-reader.xml @@ -2,7 +2,7 @@ <manifest xmlns="http://tizen.org/ns/packages" api-version="2.4" package="org.tizen.screen-reader" version="0.1.0" install-location="internal-only"> <label>screen-reader</label> <description>SMART NAVIGATOR</description> - <service-application appid="org.tizen.screen-reader" exec="/usr/apps/org.tizen.screen-reader/bin/screen-reader" nodisplay="true" multiple="false" type="capp" taskmanage="false"> + <ui-application appid="org.tizen.screen-reader" exec="/usr/apps/org.tizen.screen-reader/bin/screen-reader" nodisplay="true" multiple="false" type="capp" taskmanage="false"> <label>screen-reader</label> <icon>/usr/apps/org.tizen.screen-reader/res/icons/screen-reader.png</icon> <label xml:lang="en-us">screen-reader</label> @@ -10,6 +10,6 @@ <operation name="http://tizen.org/appcontrol/operation/read_screen"/> </app-control> <background-category value="media"/> - </service-application> + </ui-application> </manifest> diff --git a/packaging/org.tizen.screen-reader.spec b/packaging/org.tizen.screen-reader.spec index 77e376c..370015f 100755 --- a/packaging/org.tizen.screen-reader.spec +++ b/packaging/org.tizen.screen-reader.spec @@ -4,7 +4,7 @@ Name: org.tizen.screen-reader Summary: Screen Reader Assistive Technology -Version: 0.0.7 +Version: 0.0.6 Release: 1 License: Flora-1.1 Source0: %{name}-%{version}.tar.gz @@ -28,7 +28,6 @@ BuildRequires: pkgconfig(check) BuildRequires: pkgconfig(capi-network-bluetooth) BuildRequires: pkgconfig(notification) BuildRequires: pkgconfig(capi-network-wifi) -BuildRequires: pkgconfig(capi-appfw-service-application) %if "%{?tizen_profile_name}" != "tv" BuildRequires: pkgconfig(tapi) %endif @@ -59,7 +58,7 @@ make %{?jobs:-j%jobs} \ -e 's%^.*: error: .*$%\x1b[37;41m&\x1b[m%' \ -e 's%^.*: warning: .*$%\x1b[30;43m&\x1b[m%' export LD_LIBRARY_PATH=/emul/ia32-linux/lib:/emul/ia32-linux/usr/lib:$LD_LIBRARY_PATH -make test +#make test %install rm -rf %{buildroot} diff --git a/res/po/en_US.po b/res/po/en_US.po index 04325e4..8a1ec3d 100644 --- a/res/po/en_US.po +++ b/res/po/en_US.po @@ -1,10 +1,4 @@ -msgid "IDS_TRAIT_SLIDER_SWIPE_COMMUNICATE" -msgstr "flick up and down to adjust the position. " - -msgid "IDS_TRAIT_SLIDER_VALUE" -msgstr " from %.*f to %.*f, current value %.*f, " - msgid "IDS_SCROLLING_FINISHED" msgstr "Scrolling finished" @@ -223,4 +217,3 @@ msgstr "selected" msgid "IDS_TRAIT_ITEM_SELECTED_COUNT" msgstr "%d selected in total" - diff --git a/src/flat_navi.c b/src/flat_navi.c index 72aac40..3a3abe1 100644 --- a/src/flat_navi.c +++ b/src/flat_navi.c @@ -194,6 +194,16 @@ static Eina_Bool _accept_object(AtspiAccessible * obj) return EINA_FALSE; } + /* Extent of candidate object could be 0 */ + component = atspi_accessible_get_component_iface(obj); + extent = atspi_component_get_extents(component, ATSPI_COORD_TYPE_SCREEN, NULL); + + if (extent->width <= 0 || extent->height <= 0) { + g_free(extent); + return EINA_FALSE; + } + g_free(extent); + ss = atspi_accessible_get_state_set(obj); if (ss) { if (_object_is_item(obj)) { @@ -205,23 +215,10 @@ static Eina_Bool _accept_object(AtspiAccessible * obj) ret = atspi_state_set_contains(pss, ATSPI_STATE_SHOWING) && atspi_state_set_contains(pss, ATSPI_STATE_VISIBLE) && !_is_collapsed(pss); DEBUG("ITEM HAS SHOWING && VISIBLE && NOT COLLAPSED PARENT %d", ret); g_object_unref(pss); - g_object_unref(ss); return ret; } } } else { - /* Extent of candidate object could be 0 */ - component = atspi_accessible_get_component_iface(obj); - extent = atspi_component_get_extents(component, ATSPI_COORD_TYPE_SCREEN, NULL); - g_object_unref(component); - - if (extent->width <= 0 || extent->height <= 0) { - g_free(extent); - g_object_unref(ss); - return EINA_FALSE; - } - g_free(extent); - ret = atspi_state_set_contains(ss, ATSPI_STATE_SHOWING) && atspi_state_set_contains(ss, ATSPI_STATE_VISIBLE); } g_object_unref(ss); @@ -233,23 +230,17 @@ static Eina_Bool _accept_object(AtspiAccessible * obj) name = atspi_accessible_get_name(obj, NULL); ret = EINA_FALSE; - if (name) { - if (strncmp(name, "\0", 1)) { - DEBUG("Has name:[%s]", name); - ret = EINA_TRUE; - } - g_free(name); + if (strncmp(name, "\0", 1)) { + DEBUG("Has name:[%s]", name); + ret = EINA_TRUE; } - if (!ret) { - desc = atspi_accessible_get_description(obj, NULL); - if (desc) { - if (strncmp(desc, "\0", 1)) { - DEBUG("Has description:[%s]", desc); - ret = EINA_TRUE; - } - g_free(desc); - } + g_free(name); + desc = atspi_accessible_get_description(obj, NULL); + if (!ret && strncmp(desc, "\0", 1)) { + DEBUG("Has description:[%s]", desc); + ret = EINA_TRUE; } + g_free(desc); if (!ret) { action = atspi_accessible_get_action_iface(obj); if (action) { @@ -392,8 +383,6 @@ AtspiAccessible *_get_child(AtspiAccessible * obj, int i) static Eina_Bool _has_next_sibling(AtspiAccessible * obj, int next_sibling_idx_modifier) { Eina_Bool ret = EINA_FALSE; - if (!obj) return ret; - int idx = atspi_accessible_get_index_in_parent(obj, NULL); if (idx >= 0) { AtspiAccessible *parent = atspi_accessible_get_parent(obj, NULL); @@ -409,8 +398,6 @@ static Eina_Bool _has_next_sibling(AtspiAccessible * obj, int next_sibling_idx_m AtspiAccessible *_directional_depth_first_search(AtspiAccessible * root, AtspiAccessible * start, int next_sibling_idx_modifier, Eina_Bool(*stop_condition) (AtspiAccessible *)) { Eina_Bool start_is_not_defunct = EINA_FALSE; - AtspiStateSet *ss; - if (start) { AtspiStateSet *ss = atspi_accessible_get_state_set(start); start_is_not_defunct = !atspi_state_set_contains(ss, ATSPI_STATE_DEFUNCT); @@ -467,9 +454,7 @@ AtspiAccessible *_directional_depth_first_search(AtspiAccessible * root, AtspiAc g_object_unref(next_related_in_direction); relation_mode = EINA_FALSE; int cc = atspi_accessible_get_child_count(node, NULL); - ss = atspi_accessible_get_state_set(node); - - if (cc > 0 && atspi_state_set_contains(ss, ATSPI_STATE_SHOWING)) // walk down + if (cc > 0) // walk down { int idx = next_sibling_idx_modifier > 0 ? 0 : cc - 1; g_object_unref(node); @@ -482,7 +467,6 @@ AtspiAccessible *_directional_depth_first_search(AtspiAccessible * root, AtspiAc if (!node || node == root) { DEBUG("DFS END"); g_object_unref(node); - g_object_unref(ss); return NULL; } g_object_unref(node); @@ -494,7 +478,6 @@ AtspiAccessible *_directional_depth_first_search(AtspiAccessible * root, AtspiAc node = atspi_accessible_get_child_at_index(atspi_accessible_get_parent(node, NULL), idx + next_sibling_idx_modifier, NULL); //... and next DEBUG("DFS NEXT %d", idx + next_sibling_idx_modifier); } - g_object_unref(ss); } } DEBUG("DFS END"); diff --git a/src/keyboard_tracker.c b/src/keyboard_tracker.c index 70f62d9..0696183 100644 --- a/src/keyboard_tracker.c +++ b/src/keyboard_tracker.c @@ -16,7 +16,6 @@ #include <string.h> #include <atspi/atspi.h> -#include <Ecore.h> #include <Ecore_X.h> #include "keyboard_tracker.h" #include "logger.h" @@ -157,6 +156,7 @@ static gboolean device_cb(const AtspiDeviceEvent * stroke, void *data) void keyboard_tracker_init(void) { + atspi_init(); listener = atspi_device_listener_new(device_cb, NULL, NULL); atspi_register_keystroke_listener(listener, NULL, 0, ATSPI_KEY_PRESSED, ATSPI_KEYLISTENER_SYNCHRONOUS | ATSPI_KEYLISTENER_CANCONSUME, NULL); active_xwindow_property_tracker_register(); diff --git a/src/logger.c b/src/logger.c new file mode 100644 index 0000000..14d7adf --- /dev/null +++ b/src/logger.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved. + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "logger.h" + +int _eina_log_dom; + +#define SCREEN_READER_LOG_DOMAIN_NAME "screen-reader" + +int logger_init(void) +{ + eina_init(); + + if (!_eina_log_dom) { + _eina_log_dom = eina_log_domain_register(SCREEN_READER_LOG_DOMAIN_NAME, NULL); + if (_eina_log_dom < 0) { + fprintf(stderr, "Unable to register screen-reader log domain"); + return -1; + } + eina_log_domain_level_set(SCREEN_READER_LOG_DOMAIN_NAME, EINA_LOG_LEVEL_DBG); + } + return 0; +} + +void logger_shutdown(void) +{ + eina_shutdown(); + + if (_eina_log_dom) { + eina_log_domain_unregister(_eina_log_dom); + _eina_log_dom = 0; + } +} @@ -21,8 +21,6 @@ #include <appcore-efl.h> #include <Elementary.h> #include <eldbus-1/Eldbus.h> -#include <service_app.h> -#include <vconf.h> #include "navigator.h" #include "window_tracker.h" #include "logger.h" @@ -211,27 +209,21 @@ void set_signal_handler() } } -static bool app_create(void *data) +static int app_create(void *data) { - if (vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, 1)) - ERROR("Can't set value of %s vconf key to 1", VCONFKEY_SETAPPL_ACCESSIBILITY_TTS); - DEBUG("atspi_init"); - atspi_init(); - DEBUG("logger_init"); - DEBUG("screen_reader_create_service"); + elm_init(0, NULL); + + logger_init(); screen_reader_create_service(data); #ifndef SCREEN_READER_TV - DEBUG("screen_reader_gestures_init"); screen_reader_gestures_init(); - DEBUG("navigator_init"); navigator_init(); #endif - DEBUG("screen_reader_switch_enabled_set"); screen_reader_switch_enabled_set(EINA_TRUE); - return true; + return 0; } -static void app_terminate(void *data) +static int app_terminate(void *data) { DEBUG("screen reader terminating"); #ifndef SCREEN_READER_TV @@ -244,16 +236,10 @@ static void app_terminate(void *data) screen_reader_terminate_service(data); DEBUG("clear ScreenReaderEnabled property"); screen_reader_switch_enabled_set(EINA_FALSE); + DEBUG("terminate logger"); + logger_shutdown(); DEBUG("screen reader terminated"); - if (vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, 0)) - ERROR("Can't set value of %s vconf key to 0", VCONFKEY_SETAPPL_ACCESSIBILITY_TTS); - DEBUG("libatspi terminated"); - atspi_exit(); -} - -static void app_control(app_control_h app_control, void *data) -{ - return; + return 0; } int main(int argc, char **argv) @@ -261,12 +247,14 @@ int main(int argc, char **argv) set_signal_handler(); unsetenv("ELM_ATSPI_MODE"); + struct appcore_ops ops = { + .create = app_create, + .terminate = app_terminate, + .pause = NULL, + .resume = NULL, + .reset = NULL + }; + ops.data = get_pointer_to_service_data_struct(); - service_app_lifecycle_callback_s event_callback; - - event_callback.create = app_create; - event_callback.terminate = app_terminate; - event_callback.app_control = app_control; - - return service_app_main(argc, argv, &event_callback, get_pointer_to_service_data_struct()); + return appcore_efl_main("screen-reader", &argc, &argv, &ops); } diff --git a/src/navigator.c b/src/navigator.c index c965cd8..fcf5336 100644 --- a/src/navigator.c +++ b/src/navigator.c @@ -61,8 +61,6 @@ error = NULL;\ } -static void on_window_activate(void *data, AtspiAccessible * window); - typedef struct { int x, y; } last_focus_t; @@ -196,9 +194,9 @@ static void display_info_about_object(AtspiAccessible * obj, bool display_parent DEBUG("START"); DEBUG("------------------------"); - gchar *name = atspi_accessible_get_name(obj, NULL); - gchar *role = atspi_accessible_get_localized_role_name(obj, NULL); - gchar *description = atspi_accessible_get_description(obj, NULL); + const char *name = atspi_accessible_get_name(obj, NULL); + const char *role = atspi_accessible_get_localized_role_name(obj, NULL); + const char *description = atspi_accessible_get_description(obj, NULL); char *state_name = NULL; AtspiStateSet *st = atspi_accessible_get_state_set(obj); GArray *states = atspi_state_set_get_states(st); @@ -214,7 +212,7 @@ static void display_info_about_object(AtspiAccessible * obj, bool display_parent } DEBUG("NAME:%s", name); - DEBUG("ROLE:%s", role); + DEBUG("ROLE:%s", role) DEBUG("DESCRIPTION:%s", description); DEBUG("CHILDS:%d", atspi_accessible_get_child_count(obj, NULL)); DEBUG("HIGHLIGHT_INDEX:%d", atspi_component_get_highlight_index(comp, NULL)); @@ -223,7 +221,6 @@ static void display_info_about_object(AtspiAccessible * obj, bool display_parent DEBUG("VALUE:%f", atspi_value_get_current_value(value, NULL)); DEBUG("VALUE MAX:%f", atspi_value_get_maximum_value(value, NULL)); DEBUG("VALUE MIN:%f", atspi_value_get_minimum_value(value, NULL)); - g_object_unref(value); } DEBUG("STATES:"); int a; @@ -245,16 +242,13 @@ static void display_info_about_object(AtspiAccessible * obj, bool display_parent for (a = 0; ifaces && (a < ifaces->len); ++a) { gchar * interface_name = g_array_index(ifaces, gchar *, a); DEBUG(" %s", interface_name); - g_free(interface_name); + free(interface_name); } if (ifaces) g_array_free(ifaces, FALSE); DEBUG("------------------------"); DEBUG("END"); - g_free(name); - g_free(role); - g_free(description); } char *generate_description_for_subtrees(AtspiAccessible * obj) @@ -357,66 +351,6 @@ static int _find_popup_list_children_count(AtspiAccessible * obj) return 0; } -static bool _widget_has_state(AtspiAccessible * obj, AtspiStateType type) -{ - Eina_Bool ret = EINA_FALSE; - AtspiStateSet *st = atspi_accessible_get_state_set(obj); - if (atspi_state_set_contains(st, type)) - ret = EINA_TRUE; - g_object_unref(st); - return ret; -} - -int get_accuracy(double val, int max_accuracy) -{ - char val_str[HOVERSEL_TRAIT_SIZE] = ""; - int position; - int accuracy; - - snprintf(val_str, HOVERSEL_TRAIT_SIZE, "%.*f", max_accuracy, val); - accuracy = max_accuracy; - position = strlen(val_str) - 1; - while ( position > 0 && val_str[position] == '0' ) { - --position; - --accuracy; - } - return accuracy; -} - -void add_slider_description(char *dest, uint dest_size, AtspiAccessible *obj) -{ - gchar *role_name; - AtspiValue *value_iface; - double val; - double min_val; - double max_val; - char trait[HOVERSEL_TRAIT_SIZE] = ""; - int accuracy; - - role_name = atspi_accessible_get_localized_role_name(obj, NULL); - if (role_name) { - strncat(dest, role_name, dest_size - strlen(dest) - 1); - g_free(role_name); - } - - value_iface = atspi_accessible_get_value_iface(obj); - if (!value_iface) { - return; - } - - accuracy = get_accuracy( atspi_value_get_minimum_increment(value_iface, NULL), 3 ); - val = atspi_value_get_current_value(value_iface, NULL); - max_val = atspi_value_get_maximum_value(value_iface, NULL); - min_val = atspi_value_get_minimum_value(value_iface, NULL); - snprintf(trait, HOVERSEL_TRAIT_SIZE, _("IDS_TRAIT_SLIDER_VALUE"), accuracy, min_val, accuracy, max_val, accuracy, val); - strncat(dest, trait, dest_size - strlen(dest) - 1); - - if (_widget_has_state(obj, ATSPI_STATE_ENABLED)) { - strncat(dest, _("IDS_TRAIT_SLIDER_SWIPE_COMMUNICATE"), dest_size - strlen(dest) - 1); - } - g_object_unref(value_iface); -} - char *generate_trait(AtspiAccessible * obj) { if (!obj) @@ -425,21 +359,16 @@ char *generate_trait(AtspiAccessible * obj) AtspiRole role = atspi_accessible_get_role(obj, NULL); AtspiStateSet *state_set = atspi_accessible_get_state_set(obj); char ret[TTS_MAX_TEXT_SIZE] = "\0"; - switch (role) { - case ATSPI_ROLE_ENTRY: { - gchar *role_name = atspi_accessible_get_localized_role_name(obj, NULL); - if (role_name) { - strncat(ret, role_name, sizeof(ret) - strlen(ret) - 1); - strncat(ret, ", ", sizeof(ret) - strlen(ret) - 1); - if (atspi_state_set_contains(state_set, ATSPI_STATE_FOCUSED)) - strncat(ret, _("IDS_TRAIT_TEXT_EDIT_FOCUSED"), sizeof(ret) - strlen(ret) - 1); - else - strncat(ret, _("IDS_TRAIT_TEXT_EDIT"), sizeof(ret) - strlen(ret) - 1); - g_free(role_name); - } - break; - } - case ATSPI_ROLE_MENU_ITEM: { + if (role == ATSPI_ROLE_ENTRY) { + char *role_name = atspi_accessible_get_localized_role_name(obj, NULL); + strncat(ret, role_name, sizeof(ret) - strlen(ret) - 1); + strncat(ret, ", ", sizeof(ret) - strlen(ret) - 1); + if (atspi_state_set_contains(state_set, ATSPI_STATE_FOCUSED)) + strncat(ret, _("IDS_TRAIT_TEXT_EDIT_FOCUSED"), sizeof(ret) - strlen(ret) - 1); + else + strncat(ret, _("IDS_TRAIT_TEXT_EDIT"), sizeof(ret) - strlen(ret) - 1); + free(role_name); + } else if (role == ATSPI_ROLE_MENU_ITEM) { AtspiAccessible *parent = atspi_accessible_get_parent(obj, NULL); int children_count = atspi_accessible_get_child_count(parent, NULL); int index = atspi_accessible_get_index_in_parent(obj, NULL); @@ -447,9 +376,7 @@ char *generate_trait(AtspiAccessible * obj) snprintf(tab_index, MENU_ITEM_TAB_INDEX_SIZE, _("IDS_TRAIT_MENU_ITEM_TAB_INDEX"), index + 1, children_count); strncat(ret, tab_index, sizeof(ret) - strlen(ret) - 1); g_object_unref(parent); - break; - } - case ATSPI_ROLE_POPUP_MENU: { + } else if (role == ATSPI_ROLE_POPUP_MENU) { int children_count = atspi_accessible_get_child_count(obj, NULL); char trait[HOVERSEL_TRAIT_SIZE]; @@ -471,9 +398,7 @@ char *generate_trait(AtspiAccessible * obj) snprintf(trait, HOVERSEL_TRAIT_SIZE, _("IDS_TRAIT_POPUP_CLOSE")); strncat(ret, trait, sizeof(ret) - strlen(ret) - 1); - break; - } - case ATSPI_ROLE_DIALOG: { + } else if (role == ATSPI_ROLE_DIALOG) { int children_count = _find_popup_list_children_count(obj); char trait[HOVERSEL_TRAIT_SIZE]; @@ -497,18 +422,15 @@ char *generate_trait(AtspiAccessible * obj) snprintf(trait, HOVERSEL_TRAIT_SIZE, _("IDS_TRAIT_POPUP_CLOSE")); strncat(ret, trait, sizeof(ret) - strlen(ret) - 1); - break; - } - case ATSPI_ROLE_GLASS_PANE: { + } else if (role == ATSPI_ROLE_GLASS_PANE) { AtspiAccessible *parent = atspi_accessible_get_parent(obj, NULL); int children_count = atspi_accessible_get_child_count(parent, NULL); char trait[HOVERSEL_TRAIT_SIZE]; snprintf(trait, HOVERSEL_TRAIT_SIZE, _("IDS_TRAIT_PD_HOVERSEL"), children_count); strncat(ret, trait, sizeof(ret) - strlen(ret) - 1); g_object_unref(parent); - break; - } - case ATSPI_ROLE_LIST_ITEM: { + } else if (role == ATSPI_ROLE_LIST_ITEM) { + AtspiAccessible *parent = atspi_accessible_get_parent(obj, NULL); AtspiRole parent_role = atspi_accessible_get_role(parent, NULL); @@ -551,12 +473,14 @@ char *generate_trait(AtspiAccessible * obj) } else { strncat(ret, _("IDS_TRAIT_GROUP_INDEX_COLLAPSED"), sizeof(ret) - strlen(ret) - 1); } + } else { + g_object_unref(parent); + return NULL; } + g_object_unref(parent); - break; - } - case ATSPI_ROLE_CHECK_BOX: - case ATSPI_ROLE_RADIO_BUTTON: { + + } else if ((role == ATSPI_ROLE_CHECK_BOX) || (role == ATSPI_ROLE_RADIO_BUTTON)) { if (atspi_state_set_contains(state_set, ATSPI_STATE_CHECKED)) { strncat(ret, _("IDS_TRAIT_CHECK_BOX_SELECTED"), sizeof(ret) - strlen(ret) - 1); } else { @@ -564,44 +488,33 @@ char *generate_trait(AtspiAccessible * obj) } if (role == ATSPI_ROLE_RADIO_BUTTON) { - /* Say role name ("radio button"), but only if it's not a color chooser */ + /* Don't say role name if it's a color chooser radio button */ AtspiAccessible *parent; AtspiRole parent_role; parent = atspi_accessible_get_parent(obj, NULL); parent_role = atspi_accessible_get_role(parent, NULL); if (parent_role != ATSPI_ROLE_COLOR_CHOOSER) { - gchar *role_name; + char *role_name; role_name = atspi_accessible_get_localized_role_name(obj, NULL); - if (role_name) { - strncat(ret, ", ", sizeof(ret) - strlen(ret) - 1); - strncat(ret, role_name, sizeof(ret) - strlen(ret) - 1); - g_free(role_name); - } + strncat(ret, ", ", sizeof(ret) - strlen(ret) - 1); + strncat(ret, role_name, sizeof(ret) - strlen(ret) - 1); + free(role_name); } g_object_unref(parent); } - break; - } - case ATSPI_ROLE_PUSH_BUTTON: { + } else if (role == ATSPI_ROLE_PUSH_BUTTON) { strncat(ret, _("IDS_TRAIT_PUSH_BUTTON"), sizeof(ret) - strlen(ret) - 1); - break; - } - case ATSPI_ROLE_PROGRESS_BAR: { + } else if (role == ATSPI_ROLE_PROGRESS_BAR) { AtspiValue *value = atspi_accessible_get_value_iface(obj); - if (value) { - double val = atspi_value_get_current_value(value, NULL); - char trait[HOVERSEL_TRAIT_SIZE]; - if (val > 0) { - snprintf(trait, HOVERSEL_TRAIT_SIZE, _("IDS_TRAIT_PD_PROGRESSBAR_PERCENT"), val * 100); - strncat(ret, trait, sizeof(ret) - strlen(ret) - 1); - } else { - strncat(ret, _("IDS_TRAIT_PD_PROGRESSBAR"), sizeof(ret) - strlen(ret) - 1); - } - g_object_unref(value); + double val = atspi_value_get_current_value(value, NULL); + char trait[HOVERSEL_TRAIT_SIZE]; + if (val > 0) { + snprintf(trait, HOVERSEL_TRAIT_SIZE, _("IDS_TRAIT_PD_PROGRESSBAR_PERCENT"), val * 100); + strncat(ret, trait, sizeof(ret) - strlen(ret) - 1); + } else { + strncat(ret, _("IDS_TRAIT_PD_PROGRESSBAR"), sizeof(ret) - strlen(ret) - 1); } - break; - } - case ATSPI_ROLE_TOGGLE_BUTTON: { + } else if (role == ATSPI_ROLE_TOGGLE_BUTTON) { strncat(ret, _("IDS_TRAIT_TOGGLE_BUTTON"), sizeof(ret) - strlen(ret) - 1); strncat(ret, ", ", sizeof(ret) - strlen(ret) - 1); if (atspi_state_set_contains(state_set, ATSPI_STATE_CHECKED)) { @@ -609,23 +522,12 @@ char *generate_trait(AtspiAccessible * obj) } else { strncat(ret, _("IDS_TRAIT_TOGGLE_BUTTON_OFF"), sizeof(ret) - strlen(ret) - 1); } - break; - } - case ATSPI_ROLE_SLIDER: { - add_slider_description(ret, sizeof(ret), obj); - break; - } - case ATSPI_ROLE_HEADING: - case ATSPI_ROLE_GROUPING: { - break; - } - default: { - gchar *role_name = atspi_accessible_get_localized_role_name(obj, NULL); - if (role_name) { - strncat(ret, role_name, sizeof(ret) - strlen(ret) - 1); - g_free(role_name); - } - } + } else if (role == ATSPI_ROLE_HEADING) { + return strdup(""); + } else { + char *role_name = atspi_accessible_get_localized_role_name(obj, NULL); + strncat(ret, role_name, sizeof(ret) - strlen(ret) - 1); + free(role_name); } if (state_set) @@ -694,34 +596,16 @@ static char *generate_description_from_relation_object(AtspiAccessible *obj) g_free(desc); return ret; } - - if (desc) { - if (desc[0] != '\0') { - char *tmp = ret; - if (asprintf(&ret, "%s, %s", desc, ret) < 0) - ERROR("asprintf failed."); - free(tmp); - } - g_free(desc); - } - - - return ret; -} - -static char *generate_name_from_relation_object(AtspiAccessible *obj) -{ - GError *err = NULL; - char *name = atspi_accessible_get_name(obj, &err); - - if(err) + if (desc[0] != '\0') { - g_error_free(err); - g_free(name); - return NULL; + char *tmp = ret; + if (asprintf(&ret, "%s, %s", desc, ret) < 0) + ERROR("asprintf failed."); + free(tmp); } - return name; + g_free(desc); + return ret; } static char *generate_what_to_read(AtspiAccessible * obj) @@ -734,14 +618,12 @@ static char *generate_what_to_read(AtspiAccessible * obj) char *text = NULL; char ret[TTS_MAX_TEXT_SIZE] = "\0"; char *description_from_relation; - char *name_from_relation; description = atspi_accessible_get_description(obj, NULL); name = atspi_accessible_get_name(obj, NULL); role_name = generate_trait(obj); other = generate_description_for_subtrees(obj); description_from_relation = generate_text_for_relation_objects(obj, ATSPI_RELATION_DESCRIBED_BY, generate_description_from_relation_object); - name_from_relation = generate_text_for_relation_objects(obj, ATSPI_RELATION_LABELLED_BY, generate_name_from_relation_object); AtspiText *iface_text = atspi_accessible_get_text_iface(obj); if (iface_text) { text = atspi_text_get_text(iface_text, 0, atspi_text_get_character_count(iface_text, NULL), NULL); @@ -770,12 +652,6 @@ static char *generate_what_to_read(AtspiAccessible * obj) strncat(ret, names, sizeof(ret) - strlen(ret) - 1); } - if (name_from_relation && strlen(name_from_relation) > 0) { - if(strlen(ret) > 0) - strncat(ret, ", ", sizeof(ret) - strlen(ret) - 1); - strncat(ret, name_from_relation, sizeof(ret) - strlen(ret) - 1); - } - if (role_name && strlen(role_name) > 0) { if (strlen(ret) > 0) strncat(ret, ", ", sizeof(ret) - strlen(ret) - 1); @@ -797,7 +673,6 @@ static char *generate_what_to_read(AtspiAccessible * obj) free(text); free(name); free(names); - free(name_from_relation); free(description); free(role_name); free(other); @@ -1164,7 +1039,7 @@ static void _read_value(AtspiValue * value) char buf[256] = "\0"; snprintf(buf, sizeof(buf), "%d percent", proc); DEBUG("has value %s", buf); - tts_speak(buf, EINA_TRUE); + tts_speak(strdup(buf), EINA_TRUE); } static void _value_inc(void) @@ -1222,6 +1097,18 @@ static void _value_dec(void) ERROR("No value interface supported!\n"); } +static bool _check_if_widget_is_enabled(AtspiAccessible * obj) +{ + Eina_Bool ret = EINA_FALSE; + AtspiStateSet *st = atspi_accessible_get_state_set(obj); + + if (atspi_state_set_contains(st, ATSPI_STATE_ENABLED)) + ret = EINA_TRUE; + + g_object_unref(st); + return ret; +} + static void _activate_widget(void) { //activate the widget @@ -1247,7 +1134,7 @@ static void _activate_widget(void) if (!current_obj) return; - if (!_widget_has_state(current_obj, ATSPI_STATE_ENABLED)) { + if (!_check_if_widget_is_enabled(current_obj)) { DEBUG("Widget is disabled so cannot be activated"); return; } @@ -1350,10 +1237,7 @@ static void _quickpanel_change_state(gboolean quickpanel_switch) DEBUG("START"); Ecore_X_Window xwin = 0; - if (quickpanel_switch) - DEBUG("QUICKPANEL STATE ON"); - else - DEBUG("QUICKPANEL STATE OFF"); + ERROR(quickpanel_switch ? "QUICKPANEL STATE ON" : "QUICKPANEL STATE OFF"); Ecore_X_Illume_Quickpanel_State state; @@ -1829,7 +1713,7 @@ static Eina_Bool _is_enabled(void) return EINA_FALSE; } - return _widget_has_state(current_obj, ATSPI_STATE_ENABLED); + return _check_if_widget_is_enabled(current_obj); } static Eina_Bool _is_active_entry(void) @@ -1908,7 +1792,7 @@ static void _move_slider(Gesture_Info * gi) return; } - if (!_widget_has_state(obj, ATSPI_STATE_ENABLED)) { + if (!_check_if_widget_is_enabled(obj)) { DEBUG("Slider is disabled"); prepared = false; return; @@ -1935,7 +1819,7 @@ static void _move_slider(Gesture_Info * gi) if (gi->state == 1) { counter++; - DEBUG("SCROLLING but not meet counter:%d", counter); + DEBUG("SCROLLING but not meet counter:%d", counter) if (counter >= GESTURE_LIMIT) { counter = 0; DEBUG("Scroll on point %d %d", gi->x_end, gi->y_end); @@ -2145,13 +2029,13 @@ static void on_gesture_detected(void *data, Gesture_Info * info) static void _view_content_changed(AtspiAccessible * root, void *user_data) { + DEBUG("START"); if (flat_navi_is_valid(context, root)) return; - if (!_widget_has_state(root, ATSPI_STATE_SHOWING)) - return; flat_navi_context_free(context); context = flat_navi_context_create(root); _current_highlight_object_set(flat_navi_context_current_get(context)); + DEBUG("END"); } static void _new_highlighted_obj_changed(AtspiAccessible * new_highlighted_obj, void *user_data) @@ -2174,26 +2058,24 @@ static AtspiAccessible *_get_modal_descendant(AtspiAccessible * root) GError *err = NULL; AtspiStateSet *states = atspi_state_set_new(NULL); atspi_state_set_add(states, ATSPI_STATE_MODAL); - atspi_state_set_add(states, ATSPI_STATE_SHOWING); - atspi_state_set_add(states, ATSPI_STATE_VISIBLE); DEBUG("GET MODAL: STATE SET PREPARED"); AtspiMatchRule *rule = atspi_match_rule_new(states, - ATSPI_Collection_MATCH_ALL, + ATSPI_Collection_MATCH_ANY, NULL, ATSPI_Collection_MATCH_INVALID, NULL, ATSPI_Collection_MATCH_INVALID, NULL, ATSPI_Collection_MATCH_INVALID, - FALSE); + 0); DEBUG("GET MODAL: MATCHING RULE PREPARED"); AtspiAccessible *ret = NULL; AtspiCollection *col_iface = atspi_accessible_get_collection_iface(root); GArray *result = atspi_collection_get_matches(col_iface, rule, - ATSPI_Collection_SORT_ORDER_CANONICAL, + ATSPI_Collection_SORT_ORDER_INVALID, + 1, 1, - TRUE, &err); GERROR_CHECK(err); DEBUG("GET MODAL: QUERY PERFORMED"); @@ -2218,9 +2100,9 @@ static void on_window_activate(void *data, AtspiAccessible * window) if (window) { DEBUG("Window name: %s", atspi_accessible_get_name(window, NULL)); + app_tracker_callback_register(window, _view_content_changed, NULL); // TODO: modal descendant of window should be used (if exists) otherwise window AtspiAccessible *modal_descendant = _get_modal_descendant(window); - app_tracker_callback_register(modal_descendant ? modal_descendant : window, _view_content_changed, NULL); _view_content_changed(modal_descendant ? modal_descendant : window, NULL); g_object_unref(modal_descendant); } else { diff --git a/src/screen_reader_spi.c b/src/screen_reader_spi.c index 10645de..b577c0b 100644 --- a/src/screen_reader_spi.c +++ b/src/screen_reader_spi.c @@ -230,6 +230,7 @@ static char *spi_on_value_changed_get_text(AtspiEvent * event, void *user_data) char *spi_event_get_text_to_read(AtspiEvent * event, void *user_data) { DEBUG("START"); + Service_Data *sd = (Service_Data *) user_data; char *text_to_read; @@ -257,8 +258,8 @@ char *spi_event_get_text_to_read(AtspiEvent * event, void *user_data) void spi_event_listener_cb(AtspiEvent * event, void *user_data) { - DEBUG("START"); - display_info(event); + DEBUG("START") + display_info(event); if (!user_data) { ERROR("Invalid parameter"); @@ -270,11 +271,11 @@ void spi_event_listener_cb(AtspiEvent * event, void *user_data) ERROR("Can not prepare text to read"); return; } - DEBUG("SPEAK: %s", text_to_read); + DEBUG("SPEAK: %s", text_to_read) tts_speak(text_to_read, EINA_TRUE); free(text_to_read); - DEBUG("END"); + DEBUG("END") } /** @@ -296,7 +297,7 @@ void spi_init(Service_Data * sd) sd->spi_listener = atspi_event_listener_new(spi_event_listener_cb, service_data, NULL); if (sd->spi_listener == NULL) { - DEBUG("FAILED TO CREATE spi state changed listener"); + DEBUG("FAILED TO CREATE spi state changed listener") } // --------------------------------------------------------------------------------------------------- diff --git a/src/screen_reader_system.c b/src/screen_reader_system.c index b3a457b..1563666 100644 --- a/src/screen_reader_system.c +++ b/src/screen_reader_system.c @@ -538,8 +538,10 @@ void device_missed_events_get(void) } if (noti_count == 0) { + DEBUG(_("IDS_SYSTEM_NOTIFICATIONS_UNREAD_0")); tts_speak(_("IDS_SYSTEM_NOTIFICATIONS_UNREAD_0"), EINA_FALSE); } else if (noti_count == 1) { + DEBUG(_("IDS_SYSTEM_NOTIFICATIONS_UNREAD_1")); tts_speak(_("IDS_SYSTEM_NOTIFICATIONS_UNREAD_1"), EINA_FALSE); } else { DEBUG("%d %s", noti_count, _("IDS_SYSTEM_NOTIFICATIONS_UNREAD_MANY")); diff --git a/src/screen_reader_tts.c b/src/screen_reader_tts.c index 68c82ce..f5ca2e3 100644 --- a/src/screen_reader_tts.c +++ b/src/screen_reader_tts.c @@ -144,13 +144,11 @@ static void __tts_test_utt_completed_cb(tts_h tts, int utt_id, void *user_data) flush_flag = EINA_FALSE; } -#ifndef SCREEN_READER_TV if (last_utt_id == utt_id) { DEBUG("LAST UTTERANCE"); pause_state = EINA_FALSE; on_utterance_end(); } -#endif return; } @@ -296,8 +294,8 @@ Eina_Bool update_supported_voices(void *data) sd->update_language_list = EINA_TRUE; } - DEBUG("END"); - return EINA_TRUE; + DEBUG("END") + return EINA_TRUE; } void state_changed_cb(tts_h tts, tts_state_e previous, tts_state_e current, void *user_data) diff --git a/src/screen_reader_vconf.c b/src/screen_reader_vconf.c index b2daef2..f6ae5c1 100644 --- a/src/screen_reader_vconf.c +++ b/src/screen_reader_vconf.c @@ -16,7 +16,6 @@ #include <Elementary.h> #include <vconf.h> -#include <service_app.h> #include "screen_reader_vconf.h" #include "screen_reader_spi.h" #include "logger.h" @@ -43,7 +42,7 @@ void app_termination_cb(keynode_t * node, void *user_data) service_data->run_service = node->value.i; if (service_data->run_service == 0) { - service_app_exit(); + elm_exit(); } DEBUG("END"); diff --git a/src/smart_notification.c b/src/smart_notification.c index e519797..f48078c 100644 --- a/src/smart_notification.c +++ b/src/smart_notification.c @@ -188,5 +188,5 @@ static void _smart_notification_realized_items(int start_idx, int end_idx) snprintf(buf, sizeof(buf), _("IDS_REACHED_ITEMS_NOTIFICATION"), start_idx, end_idx); - tts_speak(buf, EINA_FALSE); + tts_speak(strdup(buf), EINA_FALSE); } diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 881fdb5..2ee84c1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -21,7 +21,6 @@ pkg_check_modules(tests REQUIRED check vconf elementary - capi-appfw-service-application ) FOREACH(flag ${tests_CFLAGS}) @@ -36,6 +35,7 @@ SET(TESTED_SRCS ${CMAKE_SOURCE_DIR}/src/screen_reader.c ${CMAKE_SOURCE_DIR}/src/screen_reader_vconf.c ${CMAKE_SOURCE_DIR}/src/screen_reader_spi.c ${CMAKE_SOURCE_DIR}/src/screen_reader_tts.c + ${CMAKE_SOURCE_DIR}/src/logger.c ${CMAKE_SOURCE_DIR}/src/flat_navi.c) ADD_DEFINITIONS(-DSCREEN_READER_FLAT_NAVI_TEST_DUMMY_IMPLEMENTATION) diff --git a/tests/atspi/atspi.c b/tests/atspi/atspi.c index 096a51f..9c7e584 100644 --- a/tests/atspi/atspi.c +++ b/tests/atspi/atspi.c @@ -348,16 +348,6 @@ AtspiRect *atspi_component_get_extents(AtspiComponent * component, AtspiCoordTyp rect.y = 50; rect.width = 50; rect.height = 50; - } else if (*(component->role) == ATSPI_ROLE_WINDOW) { - rect.x = 0; - rect.y = 0; - rect.width = 100; - rect.height = 100; - } else if (*(component->role) == ATSPI_ROLE_FILLER) { - rect.x = 50; - rect.y = 50; - rect.width = 50; - rect.height = 50; } else { rect.x = 0; rect.y = 0; @@ -403,7 +393,6 @@ void atspi_accessible_add_child(AtspiAccessible * obj, AtspiAccessible * child) { child->index_in_parent = obj->child_count; child->accessible_parent = obj; - obj->children = g_list_append(obj->children, child); obj->child_count++; } @@ -490,7 +479,7 @@ AtspiAccessible *atspi_relation_get_target(AtspiRelation * obj, gint i) AtspiAccessible *atspi_accessible_get_parent(AtspiAccessible * obj, GError ** error) { - return g_object_ref (obj->accessible_parent); + return obj->accessible_parent; } int atspi_component_get_highlight_index(AtspiComponent * obj, GError ** error) diff --git a/tests/smart_navi_suite.c b/tests/smart_navi_suite.c index b7b637a..31a0fd1 100644 --- a/tests/smart_navi_suite.c +++ b/tests/smart_navi_suite.c @@ -460,8 +460,9 @@ END_TEST START_TEST(spi_flat_navi_context_prev_valid_parameter3) prev = flat_navi_context_prev(ctx); fail_if(!prev || prev != child19); } -END_TEST +END_TEST +/* START_TEST(spi_flat_navi_context_last_null_parameter) { AtspiAccessible *last = flat_navi_context_last(NULL); @@ -472,7 +473,7 @@ END_TEST START_TEST(spi_flat_navi_context_last_valid_parameter) { AtspiAccessible *last = flat_navi_context_last(ctx); - fail_if(!last || last != child6); + fail_if(!last || last != child2); } END_TEST @@ -486,7 +487,7 @@ END_TEST START_TEST(spi_flat_navi_context_first_valid_parameter) { AtspiAccessible *first = flat_navi_context_first(ctx); - fail_if(!first || first != child5); + fail_if(!first || first != child1); } END_TEST @@ -511,7 +512,66 @@ START_TEST(spi_flat_navi_context_current_set_valid_parameters) } END_TEST -Suite * screen_reader_suite(void) +START_TEST(spi_flat_navi_context_line_prev_null_parameter) +{ + AtspiAccessible *prev = flat_navi_context_line_prev(NULL); + fail_if(prev); +} +END_TEST + +START_TEST(spi_flat_navi_context_line_prev_valid_parameter) +{ + AtspiAccessible *prev = flat_navi_context_line_prev(ctx); + fail_if(prev); + flat_navi_context_current_set(ctx, child4); + prev = flat_navi_context_line_prev(ctx); + fail_if(!prev || prev != child1); +} +END_TEST + +START_TEST(spi_flat_navi_context_line_next_null_parameter) +{ + AtspiAccessible *next = flat_navi_context_line_next(NULL); + fail_if(next); +} +END_TEST + +START_TEST(spi_flat_navi_context_line_next_valid_parameter) +{ + AtspiAccessible *next = flat_navi_context_line_next(ctx); + fail_if(!next || next != child3); +} +END_TEST + +START_TEST(spi_flat_navi_context_line_first_null_parameter) +{ + AtspiAccessible *first = flat_navi_context_line_first(NULL); + fail_if(first); +} +END_TEST + +START_TEST(spi_flat_navi_context_line_first_valid_parameter) +{ + AtspiAccessible *first = flat_navi_context_line_first(ctx); + fail_if(!first || first != child1); +} +END_TEST + +START_TEST(spi_flat_navi_context_line_last_null_parameter) +{ + AtspiAccessible *last = flat_navi_context_line_last(NULL); + fail_if(last); +} +END_TEST + +START_TEST(spi_flat_navi_context_line_last_valid_parameter) +{ + AtspiAccessible *last = flat_navi_context_line_last(ctx); + fail_if(!last || last != child3); +} +END_TEST +*/ + Suite * screen_reader_suite(void) { Suite *s; TCase *tc_spi_screen_reader_init; @@ -543,7 +603,6 @@ Suite * screen_reader_suite(void) tcase_add_test(tc_spi_screen_reader_on_state_changed, spi_on_state_change_role); tcase_add_test(tc_spi_screen_reader_on_caret_move, spi_on_caret_move); tcase_add_test(tc_spi_screen_reader_on_access_value, spi_on_value_changed); - tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_create_null_parameter); tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_create_valid_parameter); @@ -562,14 +621,22 @@ Suite * screen_reader_suite(void) tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_prev_valid_parameter); tcase_add_test(tc_spi_screen_reader_flat_navi2, spi_flat_navi_context_prev_valid_parameter2); tcase_add_test(tc_spi_screen_reader_flat_navi2, spi_flat_navi_context_prev_valid_parameter3); - - tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_last_null_parameter); - tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_last_valid_parameter); - tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_first_null_parameter); - tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_first_valid_parameter); - tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_current_set_null_parameters); - tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_current_set_valid_parameters); - + /* + tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_last_null_parameter); + tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_last_valid_parameter); + tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_first_null_parameter); + tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_first_valid_parameter); + tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_current_set_null_parameters); + tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_current_set_valid_parameters); + tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_line_prev_null_parameter); + tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_line_prev_valid_parameter); + tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_line_next_null_parameter); + tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_line_next_valid_parameter); + tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_line_first_null_parameter); + tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_line_first_valid_parameter); + tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_line_last_null_parameter); + tcase_add_test(tc_spi_screen_reader_flat_navi, spi_flat_navi_context_line_last_valid_parameter); + */ suite_add_tcase(s, tc_spi_screen_reader_init); suite_add_tcase(s, tc_spi_screen_reader_on_state_changed); suite_add_tcase(s, tc_spi_screen_reader_on_caret_move); @@ -589,7 +656,7 @@ int main() s = screen_reader_suite(); sr = srunner_create(s); - srunner_run_all(sr, CK_VERBOSE); + srunner_run_all(sr, CK_NORMAL); number_failed = srunner_ntests_failed(sr); srunner_free(sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; |