*/
void utc_context_trigger_cleanup(void)
{
+ int error = CONTEXT_TRIGGER_ERROR_NONE;
int* enabled_arr = NULL;
int enabled_count = 0;
int* disabled_arr = NULL;
if (!is_trigger_supported)
return;
- context_trigger_get_own_rule_ids(&enabled_arr, &enabled_count, &disabled_arr, &disabled_count);
+ error = context_trigger_get_own_rule_ids(&enabled_arr, &enabled_count, &disabled_arr, &disabled_count);
+ TRIGGER_ASSERT_EQ_WITH_CHECK_SUPPORTED(is_trigger_supported, error, CONTEXT_TRIGGER_ERROR_NONE);
for (i = 0; i < enabled_count; i++) {
context_trigger_disable_rule(enabled_arr[i]);
int error = CONTEXT_TRIGGER_ERROR_NONE;
context_trigger_rule_h rule = NULL;
context_trigger_rule_entry_h event = NULL;
- int rule_id;
+ int rule_id = 0;
context_trigger_rule_h rule_result = NULL;
const char* description = "At 15:00";
char* des_result = NULL;
context_trigger_rule_event_create(CONTEXT_TRIGGER_EVENT_CALL, CONTEXT_TRIGGER_LOGICAL_CONJUNCTION, &e_call);
context_trigger_rule_condition_create(CONTEXT_TRIGGER_CONDITION_WIFI, CONTEXT_TRIGGER_LOGICAL_CONJUNCTION, &c_wifi);
context_trigger_rule_entry_add_key(c_wifi, CONTEXT_TRIGGER_LOGICAL_CONJUNCTION, CONTEXT_TRIGGER_STATE);
- context_trigger_rule_entry_add_comparison(c_wifi, CONTEXT_TRIGGER_STATE, CONTEXT_TRIGGER_EQUAL_TO, CONTEXT_TRIGGER_STATE);
+
+ error = context_trigger_rule_entry_add_comparison(c_wifi, CONTEXT_TRIGGER_STATE, CONTEXT_TRIGGER_EQUAL_TO, CONTEXT_TRIGGER_STATE);
+ assert_eq(error, CONTEXT_TRIGGER_ERROR_NONE);
+
context_trigger_rule_condition_create(CONTEXT_TRIGGER_CONDITION_COMMUNICATION_FREQUENCY, CONTEXT_TRIGGER_LOGICAL_CONJUNCTION, &c_comm);
- context_trigger_rule_entry_add_option(c_comm, CONTEXT_TRIGGER_ADDRESS, CONTEXT_TRIGGER_ADDRESS);
+
+ error = context_trigger_rule_entry_add_option(c_comm, CONTEXT_TRIGGER_ADDRESS, CONTEXT_TRIGGER_ADDRESS);
+ assert_eq(error, CONTEXT_TRIGGER_ERROR_NONE);
+
context_trigger_rule_entry_add_key(c_comm, CONTEXT_TRIGGER_LOGICAL_CONJUNCTION, CONTEXT_TRIGGER_RANK);
context_trigger_rule_entry_add_comparison_int(c_comm, CONTEXT_TRIGGER_RANK, CONTEXT_TRIGGER_LESS_THAN, 6);
context_trigger_rule_add_entry(rule2, e_call);
// Err: Invalid referential comparison key (attribute data not provided)
- context_trigger_rule_entry_add_key(c_wifi, CONTEXT_TRIGGER_LOGICAL_CONJUNCTION, CONTEXT_TRIGGER_BSSID);
+ error = context_trigger_rule_entry_add_key(c_wifi, CONTEXT_TRIGGER_LOGICAL_CONJUNCTION, CONTEXT_TRIGGER_BSSID);
+ TRIGGER_ASSERT_EQ_WITH_CHECK_SUPPORTED(is_trigger_supported, error, CONTEXT_TRIGGER_ERROR_NONE);
+
context_trigger_rule_entry_add_comparison(c_wifi, CONTEXT_TRIGGER_BSSID, CONTEXT_TRIGGER_EQUAL_TO, CONTEXT_TRIGGER_EVENT);
error = context_trigger_rule_add_entry(rule2, c_wifi);
TRIGGER_ASSERT_EQ_WITH_CHECK_SUPPORTED(is_trigger_supported, error, CONTEXT_TRIGGER_ERROR_INVALID_RULE);
// Err: Referential comparison data type not matched
context_trigger_rule_entry_add_key(c_headphone, CONTEXT_TRIGGER_LOGICAL_CONJUNCTION, CONTEXT_TRIGGER_IS_CONNECTED);
- context_trigger_rule_entry_add_comparison(c_headphone, CONTEXT_TRIGGER_IS_CONNECTED, CONTEXT_TRIGGER_EQUAL_TO, CONTEXT_TRIGGER_MEDIUM);
+
+ error = context_trigger_rule_entry_add_comparison(c_headphone, CONTEXT_TRIGGER_IS_CONNECTED, CONTEXT_TRIGGER_EQUAL_TO, CONTEXT_TRIGGER_MEDIUM);
+ TRIGGER_ASSERT_EQ_WITH_CHECK_SUPPORTED(is_trigger_supported, error, CONTEXT_TRIGGER_ERROR_NONE);
+
error = context_trigger_rule_add_entry(rule3, c_headphone);
TRIGGER_ASSERT_EQ_WITH_CHECK_SUPPORTED(is_trigger_supported, error, CONTEXT_TRIGGER_ERROR_INVALID_RULE);
context_trigger_rule_add_entry(rule4, e_call3);
// Err: Invalid referential option key (attribute data not provided)
- context_trigger_rule_entry_add_option(c_comm3, CONTEXT_TRIGGER_ADDRESS, CONTEXT_TRIGGER_APP_ID);
+ error = context_trigger_rule_entry_add_option(c_comm3, CONTEXT_TRIGGER_ADDRESS, CONTEXT_TRIGGER_APP_ID);
+ assert_eq(error, CONTEXT_TRIGGER_ERROR_NONE);
+
context_trigger_rule_entry_add_key(c_comm3, CONTEXT_TRIGGER_LOGICAL_CONJUNCTION, CONTEXT_TRIGGER_RANK);
context_trigger_rule_entry_add_comparison_int(c_comm3, CONTEXT_TRIGGER_RANK, CONTEXT_TRIGGER_LESS_THAN, 6);
error = context_trigger_rule_add_entry(rule4, c_comm3);
int utc_context_trigger_rule_set_action_app_control_n(void)
{
int error = CONTEXT_TRIGGER_ERROR_NONE;
+ int app_err = APP_CONTROL_ERROR_NONE;
bool ret = initialize_app_handle();
assert_eq(ret, true);
#ifdef MOBILE
// Err: Invalid app id
- app_control_create(&invalid_app);
- app_control_set_operation(invalid_app, APP_CONTROL_OPERATION_DEFAULT);
- app_control_set_app_id (invalid_app, "invalid_app_id");
+ app_err = app_control_create(&invalid_app);
+ assert_eq(app_err, APP_CONTROL_ERROR_NONE);
+
+ app_err = app_control_set_operation(invalid_app, APP_CONTROL_OPERATION_DEFAULT);
+ assert_eq_destroy(app_err, APP_CONTROL_ERROR_NONE, invalid_app);
+
+ app_err = app_control_set_app_id (invalid_app, "invalid_app_id");
+ assert_eq_destroy(app_err, APP_CONTROL_ERROR_NONE, invalid_app);
error = context_trigger_rule_set_action_app_control(rule, invalid_app);
app_control_destroy(invalid_app);
// Err: Service application
app_control_h service_app;
- app_control_create(&service_app);
- app_control_set_operation(service_app, APP_CONTROL_OPERATION_DEFAULT);
- app_control_set_app_id (service_app, "org.tizen.testservice");
+
+ app_err = app_control_create(&service_app);
+ assert_eq(app_err, APP_CONTROL_ERROR_NONE);
+
+ app_err = app_control_set_operation(service_app, APP_CONTROL_OPERATION_DEFAULT);
+ assert_eq_destroy(app_err, APP_CONTROL_ERROR_NONE, service_app);
+
+ app_err = app_control_set_app_id (service_app, "org.tizen.testservice");
+ assert_eq_destroy(app_err, APP_CONTROL_ERROR_NONE, service_app);
error = context_trigger_rule_set_action_app_control(rule, service_app);
app_control_destroy(service_app);
int utc_context_trigger_rule_set_action_notification_n(void)
{
int error = CONTEXT_TRIGGER_ERROR_NONE;
+ int app_err = APP_CONTROL_ERROR_NONE;
bool ret = initialize_app_handle();
assert_eq(ret, true);
#ifdef MOBILE
// Err: Invalid app id
app_control_h invalid_app = NULL;
- app_control_create(&invalid_app);
- app_control_set_operation(invalid_app, APP_CONTROL_OPERATION_DEFAULT);
- app_control_set_app_id (invalid_app, "invalid_app_id");
+
+ app_err = app_control_create(&invalid_app);
+ assert_eq(app_err, APP_CONTROL_ERROR_NONE);
+
+ app_err = app_control_set_operation(invalid_app, APP_CONTROL_OPERATION_DEFAULT);
+ assert_eq_destroy(app_err, APP_CONTROL_ERROR_NONE, invalid_app);
+
+ app_err = app_control_set_app_id (invalid_app, "invalid_app_id");
+ assert_eq_destroy(app_err, APP_CONTROL_ERROR_NONE, invalid_app);
error = context_trigger_rule_set_action_app_control(rule, invalid_app);
app_control_destroy(invalid_app);
error = context_trigger_custom_publish(CUSTOM_ITEM_WEATHER, CUSTOM_WEATHER_DATA1);
TRIGGER_ASSERT_EQ_WITH_CHECK_SUPPORTED(is_trigger_supported, error, CONTEXT_TRIGGER_ERROR_NOT_SUPPORTED);
- context_trigger_custom_register(CUSTOM_ITEM_WEATHER, CUSTOM_WEATHER_TEMPLATE);
+ error = context_trigger_custom_register(CUSTOM_ITEM_WEATHER, CUSTOM_WEATHER_TEMPLATE);
+ TRIGGER_ASSERT_EQ_WITH_CHECK_SUPPORTED(is_trigger_supported, error, CONTEXT_TRIGGER_ERROR_NONE);
// Err: Invalid parameter
error = context_trigger_custom_publish(CUSTOM_ITEM_WEATHER, NULL);
context_trigger_rule_entry_h event1 = NULL;
context_trigger_rule_entry_h event2 = NULL;
- context_trigger_custom_register(CUSTOM_ITEM_WEATHER, CUSTOM_WEATHER_TEMPLATE);
+ error = context_trigger_custom_register(CUSTOM_ITEM_WEATHER, CUSTOM_WEATHER_TEMPLATE);
+ TRIGGER_ASSERT_EQ_WITH_CHECK_SUPPORTED(is_trigger_supported, error, CONTEXT_TRIGGER_ERROR_NONE);
error = context_trigger_rule_custom_event_create(CUSTOM_ITEM_WEATHER, CONTEXT_TEST_PACKAGE_ID, CONTEXT_TRIGGER_LOGICAL_CONJUNCTION, &event1);
TRIGGER_ASSERT_EQ_WITH_CHECK_SUPPORTED(is_trigger_supported, error, CONTEXT_TRIGGER_ERROR_NONE);
context_trigger_rule_entry_h condition1 = NULL;
context_trigger_rule_entry_h condition2 = NULL;
- context_trigger_custom_register(CUSTOM_ITEM_WEATHER, CUSTOM_WEATHER_TEMPLATE);
+ error = context_trigger_custom_register(CUSTOM_ITEM_WEATHER, CUSTOM_WEATHER_TEMPLATE);
+ TRIGGER_ASSERT_EQ_WITH_CHECK_SUPPORTED(is_trigger_supported, error, CONTEXT_TRIGGER_ERROR_NONE);
error = context_trigger_rule_custom_condition_create(CUSTOM_ITEM_WEATHER, CONTEXT_TEST_PACKAGE_ID, CONTEXT_TRIGGER_LOGICAL_CONJUNCTION, &condition1);
TRIGGER_ASSERT_EQ_WITH_CHECK_SUPPORTED(is_trigger_supported, error, CONTEXT_TRIGGER_ERROR_NONE);