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;
-
- result = _sane_kds_s2000w_net_start(h);
-
- assert_int_equal(result, SANE_STATUS_NO_DOCS);
- assert_int_equal(h->current_scan_status->complete_scanned, 0);
-
- json_object_put(h->current_scanner_config);
- h->current_scanner_config = NULL;
- kds_s2000w_client_response_free(resp_status);
- resp_status = NULL;
-
- free_handler(h);
- h = NULL;
-}
-
void sane_kds_s2000w_net_get_parameter_cancel()
{
handler* h = init_handler();