h = NULL;
}
-void sane_kds_s2000w_net_start_slow_two_pages_per_feeder(void** state)
-{
- response** response_list = (response**) *state;
- will_return(mock_response, response_list[0]);
- will_return(__wrap_kds_s2000w_client_start_scan, 0);
- response* resp_status = kds_s2000w_client_response_init();
- resp_status->data = realloc(resp_status->data, 205);
- const char* status = "{ \
- \"Status\": { \
- \"NumImagesScanned\": 1, \
- \"NumImagesStored\": 1, \
- \"State\": \"Scanning\", \
- \"ErrorNum\": 0, \
- \"LastError\": \"Status: 200 Success\", \
- \"PaperDetected\": \"0\", \
- \"PercentAvailable\": 99 \
- }}\0";
- memcpy(resp_status->data, status, 205);
- resp_status->code = 200;
- resp_status->size = 205;
- will_return(mock_response, resp_status);
- will_return(__wrap_kds_s2000w_client_status_session, 0);
- will_return(mock_response, response_list[2]);
- will_return(__wrap_kds_s2000w_client_get_image, 0);
- will_return(mock_response, response_list[0]);
- will_return(__wrap_kds_s2000w_client_delete_image, 0);
- expect_function_call(__wrap_kds_s2000w_client_start_scan);
- expect_function_call(__wrap_kds_s2000w_client_status_session);
- expect_function_call(__wrap_kds_s2000w_client_get_image);
- expect_function_call(__wrap_kds_s2000w_client_delete_image);
-
- handler* h = init_handler();
- h->current_scan_status->feeder = 1;
- const char* test_config = "{\"Configuration\": { \"ColorMode\": \"Color\" } }";
- h->current_scanner_config = json_tokener_parse(test_config);
-
- int result = _sane_kds_s2000w_net_start(h);
-
- resp_status->data = realloc(resp_status->data, 210);
- const char* status2 = "{ \
- \"Status\": { \
- \"NumImagesScanned\": 2, \
- \"NumImagesStored\": 1, \
- \"State\": \"Done Scanning\", \
- \"ErrorNum\": 0, \
- \"LastError\": \"Status: 200 Success\", \
- \"PaperDetected\": \"0\", \
- \"PercentAvailable\": 99 \
- }}\0";
- memcpy(resp_status->data, status2, 210);
- resp_status->code = 200;
- resp_status->size = 210;
- will_return(mock_response, resp_status);
- will_return(__wrap_kds_s2000w_client_status_session, 0);
- will_return(mock_response, response_list[2]);
- will_return(__wrap_kds_s2000w_client_get_image, 0);
- will_return(mock_response, response_list[0]);
- will_return(__wrap_kds_s2000w_client_delete_image, 0);
- response* resp_open_session = kds_s2000w_client_response_init();
- resp_open_session->data = realloc(resp_open_session->data, 25);
- const char* session_data = "{\"SessionId\":\"8154711\"}\0";
- memcpy(resp_open_session->data, session_data, 25);
- resp_open_session->code = 200;
- resp_open_session->size = 25;
- will_return(mock_response, resp_open_session);
- will_return(__wrap_kds_s2000w_client_open_session, 0);
- response* resp_set_option = kds_s2000w_client_response_init();
- resp_set_option->code = 200;
- will_return(mock_response, resp_set_option);
- will_return(__wrap_kds_s2000w_client_set_option, 0);
- expect_function_call(__wrap_kds_s2000w_client_status_session);
- expect_function_call(__wrap_kds_s2000w_client_get_image);
- expect_function_call(__wrap_kds_s2000w_client_delete_image);
- expect_function_call(__wrap_kds_s2000w_client_close_session);
- expect_function_call(__wrap_kds_s2000w_client_open_session);
- expect_function_call(__wrap_kds_s2000w_client_set_option);
- result = _sane_kds_s2000w_net_start(h);
-
- assert_int_equal(result, SANE_STATUS_GOOD);
- assert_int_equal(h->current_scan_status->complete_scanned, 1);
-
- json_object_put(h->current_scanner_config);
- h->current_scanner_config = NULL;
- kds_s2000w_client_response_free(resp_status);
- resp_status = NULL;
- kds_s2000w_client_response_free(resp_open_session);
- resp_open_session = NULL;
- kds_s2000w_client_response_free(resp_set_option);
- resp_set_option = NULL;
- free_handler(h);
- h = NULL;
-}
-
void sane_kds_s2000w_net_get_parameter_cancel()
{
handler* h = init_handler();
assert_string_equal(SANE_DESC_SCAN_SOURCE, option->desc);
assert_int_equal(SANE_TYPE_STRING, option->type);
assert_int_equal(SANE_UNIT_NONE, option->unit);
- assert_int_equal(sizeof(SANE_String_Const*) * 4, option->size);
+ assert_int_equal(sizeof(SANE_String_Const*) * 3, option->size);
assert_int_equal(SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, option->cap);
assert_int_equal(SANE_CONSTRAINT_STRING_LIST, option->constraint_type);
assert_string_equal("DocumentFeeder", option->constraint.string_list[0]);
- assert_string_equal("Automatic", option->constraint.string_list[1]);
- assert_string_equal("Flatbed", option->constraint.string_list[2]);
- assert_null(option->constraint.string_list[3]);
+ assert_string_equal("Flatbed", option->constraint.string_list[1]);
+ assert_null(option->constraint.string_list[2]);
}
void kds_s2000w_option_get_descriptor_three()