From: Bastian Dehn Date: Sun, 16 Feb 2025 17:40:00 +0000 (+0100) Subject: add option for color contrast X-Git-Tag: v1.1.0^2~4^2~8 X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=d629aa0e699f22a9aae8a0485a574b8e558cf9bb;p=sane-kds-s2000w-net.git add option for color contrast --- diff --git a/src/kds_s2000w_handler_opts.c b/src/kds_s2000w_handler_opts.c index beeb8d2..38a4ae0 100644 --- a/src/kds_s2000w_handler_opts.c +++ b/src/kds_s2000w_handler_opts.c @@ -6,7 +6,7 @@ #include "kds_s2000w_debug.h" #define AUTOSTART_ON 1 -#define OPTION_COUNT 38 +#define OPTION_COUNT 39 void _kds_s2000w_handler_opts_write_string_value(json_object* value_object, void* value) { @@ -278,6 +278,10 @@ void kds_s2000w_handler_opts_get_option(handler* h, uint32_t option, void* value value_object = json_object_object_get(config, "DocumentFeederTimeout"); _kds_s2000w_handler_opts_write_int_value(value_object, value); break; + case 37: + value_object = json_object_object_get(config, "ColorContrast"); + _kds_s2000w_handler_opts_write_int_value(value_object, value); + break; default: break; } @@ -453,6 +457,10 @@ void kds_s2000w_handler_opts_set_option(handler* h, uint32_t option, void* value _kds_s2000w_handler_opts_write_int_value_to_json(value_object, value); break; case 37: + value_object = json_object_object_get(config, "ColorContrast"); + _kds_s2000w_handler_opts_write_int_value_to_json(value_object, value); + break; + case 38: _kds_s2000w_handler_opts_set_option_to_default(h); _kds_s2000w_handler_opts_set_autostart_on(h); diff --git a/tests/kds_s2000w_net_get_opt_tests.c b/tests/kds_s2000w_net_get_opt_tests.c index c97544e..05a33a5 100644 --- a/tests/kds_s2000w_net_get_opt_tests.c +++ b/tests/kds_s2000w_net_get_opt_tests.c @@ -21,7 +21,7 @@ void sane_kds_s2000w_net_control_get_option_zero_test(void** state) sane_kds_s2000w_net_control_option(h, 0, SANE_ACTION_GET_VALUE, &value, NULL); - assert_int_equal(value, 38); + assert_int_equal(value, 39); kds_s2000w_handler_free(h); h = NULL; @@ -534,6 +534,21 @@ void sane_kds_s2000w_net_control_get_option_thirdysix_test(void** state) assert_int_equal(value, 2); + kds_s2000w_handler_free(h); + h = NULL; +} + +void sane_kds_s2000w_net_control_get_option_thirdyseven_test(void** state) +{ + handler* h = kds_s2000w_handler_init(); + response* resp = (response*) *state; + h->current_scanner_config = json_tokener_parse(resp->data); + uint32_t value = -1; + + sane_kds_s2000w_net_control_option(h, 37, SANE_ACTION_GET_VALUE, &value, NULL); + + assert_int_equal(value, 0); + kds_s2000w_handler_free(h); h = NULL; } \ No newline at end of file diff --git a/tests/kds_s2000w_net_get_opt_tests.h b/tests/kds_s2000w_net_get_opt_tests.h index 9fb4ee4..4d3e507 100644 --- a/tests/kds_s2000w_net_get_opt_tests.h +++ b/tests/kds_s2000w_net_get_opt_tests.h @@ -41,5 +41,6 @@ void sane_kds_s2000w_net_control_get_option_thirdythree_test(void** state); void sane_kds_s2000w_net_control_get_option_thirdyfour_test(void** state); void sane_kds_s2000w_net_control_get_option_thirdyfive_test(void** state); void sane_kds_s2000w_net_control_get_option_thirdysix_test(void** state); +void sane_kds_s2000w_net_control_get_option_thirdyseven_test(void** state); #endif \ No newline at end of file diff --git a/tests/kds_s2000w_net_get_opt_tests_run.c b/tests/kds_s2000w_net_get_opt_tests_run.c index 59d0599..1079514 100644 --- a/tests/kds_s2000w_net_get_opt_tests_run.c +++ b/tests/kds_s2000w_net_get_opt_tests_run.c @@ -110,7 +110,8 @@ int main() cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdythree_test, setup_default_get_option, teardown_default_get_option), cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdyfour_test, setup_default_get_option, teardown_default_get_option), cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdyfive_test, setup_default_get_option, teardown_default_get_option), - cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdysix_test, setup_default_get_option, teardown_default_get_option) + cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdysix_test, setup_default_get_option, teardown_default_get_option), + cmocka_unit_test_setup_teardown(sane_kds_s2000w_net_control_get_option_thirdyseven_test, setup_default_get_option, teardown_default_get_option) }; return cmocka_run_group_tests(net_tests, NULL, NULL);