#include "kds_s2000w_option_descriptors.h"
#include "kds_s2000w_debug.h"
-#define MAX_OPTION_COUNT 24
+#define MAX_OPTION_COUNT 25
SANE_Option_Descriptor* descriptor_array = NULL;
SANE_String_Const* constraint_scan_source = NULL;
SANE_String_Const* constraint_color_sharpen = NULL;
SANE_String_Const* constraint_multifeed_sensitivity = NULL;
+SANE_String_Const* constraint_multifeed_response = NULL;
SANE_Option_Descriptor _kds_s2000w_option_descriptor_standard_group()
{
SANE_Option_Descriptor _kds_s2000w_option_descriptor_multifeed_sensitivity()
{
- kds_s2000w_debug_printf(ALL, "_kds_s2000w_option_descriptor_multifeed_sensitivity");
+ kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_multifeed_sensitivity");
constraint_multifeed_sensitivity = malloc(sizeof(SANE_String_Const*) * 5);
constraint_multifeed_sensitivity[0] = "None";
return descriptor;
}
+SANE_Option_Descriptor _kds_s2000w_option_descriptor_multifeed_response()
+{
+ kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_multifeed_response");
+
+ constraint_multifeed_response = malloc(sizeof(SANE_String_Const*) * 5);
+ constraint_multifeed_response[0] = "Stop";
+ constraint_multifeed_response[1] = "StopAndGenerateImage";
+ constraint_multifeed_response[2] = NULL;
+
+ SANE_Option_Descriptor descriptor = {
+ "multifeed-response",
+ "multifeed response",
+ "multifeed response",
+ SANE_TYPE_STRING,
+ SANE_UNIT_NONE,
+ sizeof(SANE_String_Const*) * 3,
+ SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT,
+ SANE_CONSTRAINT_STRING_LIST,
+ {.string_list = constraint_multifeed_response}
+ };
+
+ return descriptor;
+}
+
void kds_s2000w_option_descriptors_init()
{
kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_init_option_descriptors");
descriptor_array[20] = _kds_s2000w_option_descriptor_background_smoothing_aggressiveness();
descriptor_array[21] = _kds_s2000w_option_descriptor_binarization_contrast();
descriptor_array[22] = _kds_s2000w_option_descriptor_multifeed_sensitivity();
- descriptor_array[23] = _kds_s2000w_option_descriptor_config_reset();
+ descriptor_array[23] = _kds_s2000w_option_descriptor_multifeed_response();
+ descriptor_array[24] = _kds_s2000w_option_descriptor_config_reset();
}
void kds_s2000w_option_descriptors_free()
constraint_color_sharpen = NULL;
free(constraint_multifeed_sensitivity);
constraint_multifeed_sensitivity = NULL;
+ free(constraint_multifeed_response);
+ constraint_multifeed_response = NULL;
free(descriptor_array);
descriptor_array = NULL;
}
#include "kds_s2000w_client_mock.h"
#include "../src/kds_s2000w_option_descriptors.h"
-#define MAX_OPTION_COUNT 24
+#define MAX_OPTION_COUNT 25
int setup(void** state)
{
{
SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(23);
+ assert_string_equal("multifeed-response", option->name);
+ assert_string_equal("multifeed response", option->title);
+ assert_string_equal("multifeed response", 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*) * 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("Stop", option->constraint.string_list[0]);
+ assert_string_equal("StopAndGenerateImage", option->constraint.string_list[1]);
+ assert_null(option->constraint.string_list[2]);
+}
+
+void kds_s2000w_option_get_descriptor_twentyfour_test()
+{
+ SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(24);
+
assert_string_equal("config-reset", option->name);
assert_string_equal("reset config", option->title);
assert_string_equal("load default configuration from scanner", option->desc);
cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentyone_test, setup, teardown),
cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentytwo_test, setup, teardown),
cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentythree_test, setup, teardown),
+ cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentyfour_test, setup, teardown),
cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_over_max_options_test, setup, teardown)
};