From ccf0f61daf8216cf221b266474d48dd06fc712b7 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Sun, 16 Feb 2025 10:44:15 +0100 Subject: [PATCH] add option descriptor for hole fill --- src/kds_s2000w_option_descriptors.c | 24 +++++++++++++++++-- tests/kds_s2000w_option_descriptor_tests.c | 16 ++++++++++++- tests/kds_s2000w_option_descriptor_tests.h | 1 + .../kds_s2000w_option_descriptor_tests_run.c | 4 +++- 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/kds_s2000w_option_descriptors.c b/src/kds_s2000w_option_descriptors.c index df808b6..5453cbf 100644 --- a/src/kds_s2000w_option_descriptors.c +++ b/src/kds_s2000w_option_descriptors.c @@ -3,7 +3,7 @@ #include "kds_s2000w_option_descriptors.h" #include "kds_s2000w_debug.h" -#define MAX_OPTION_COUNT 31 +#define MAX_OPTION_COUNT 32 SANE_Option_Descriptor* descriptor_array = NULL; @@ -733,6 +733,25 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_document_feeder_timeout_res return descriptor; } +SANE_Option_Descriptor _kds_s2000w_option_descriptor_hole_fill() +{ + kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_hole_fill"); + + + SANE_Option_Descriptor descriptor = { + "hole-fill", + "Hole Fill", + "Hole Fill", + SANE_TYPE_BOOL, + SANE_UNIT_NONE, + sizeof(SANE_Bool), + SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, + SANE_CONSTRAINT_NONE, + }; + + return descriptor; +} + void kds_s2000w_option_descriptors_init() { kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_init_option_descriptors"); @@ -768,7 +787,8 @@ void kds_s2000w_option_descriptors_init() descriptor_array[27] = _kds_s2000w_option_descriptor_transport_handling(); descriptor_array[28] = _kds_s2000w_option_descriptor_jpeg_quality(); descriptor_array[29] = _kds_s2000w_option_descriptor_document_feeder_timeout_response(); - descriptor_array[30] = _kds_s2000w_option_descriptor_config_reset(); + descriptor_array[30] = _kds_s2000w_option_descriptor_hole_fill(); + descriptor_array[31] = _kds_s2000w_option_descriptor_config_reset(); } void kds_s2000w_option_descriptors_free() diff --git a/tests/kds_s2000w_option_descriptor_tests.c b/tests/kds_s2000w_option_descriptor_tests.c index c8f5b9c..1ef82a2 100644 --- a/tests/kds_s2000w_option_descriptor_tests.c +++ b/tests/kds_s2000w_option_descriptor_tests.c @@ -4,7 +4,7 @@ #include "kds_s2000w_client_mock.h" #include "../src/kds_s2000w_option_descriptors.h" -#define MAX_OPTION_COUNT 31 +#define MAX_OPTION_COUNT 32 int setup(void** state) { @@ -552,6 +552,20 @@ void kds_s2000w_option_get_descriptor_thirdy_test() { SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(30); + assert_string_equal("hole-fill", option->name); + assert_string_equal("Hole Fill", option->title); + assert_string_equal("Hole Fill", option->desc); + assert_int_equal(SANE_TYPE_BOOL, option->type); + assert_int_equal(SANE_UNIT_NONE, option->unit); + assert_int_equal(sizeof(SANE_Bool), option->size); + assert_int_equal(SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, option->cap); + assert_int_equal(SANE_CONSTRAINT_NONE, option->constraint_type); +} + +void kds_s2000w_option_get_descriptor_thirdyone_test() +{ + SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(31); + assert_string_equal("config-reset", option->name); assert_string_equal("reset config", option->title); assert_string_equal("load default configuration from scanner", option->desc); diff --git a/tests/kds_s2000w_option_descriptor_tests.h b/tests/kds_s2000w_option_descriptor_tests.h index 0c4c72b..c409653 100644 --- a/tests/kds_s2000w_option_descriptor_tests.h +++ b/tests/kds_s2000w_option_descriptor_tests.h @@ -39,5 +39,6 @@ void kds_s2000w_option_get_descriptor_twentyseven_test(); void kds_s2000w_option_get_descriptor_twentyeight_test(); void kds_s2000w_option_get_descriptor_twentynine_test(); void kds_s2000w_option_get_descriptor_thirdy_test(); +void kds_s2000w_option_get_descriptor_thirdyone_test(); void kds_s2000w_option_get_descriptor_over_max_options_test(); #endif \ No newline at end of file diff --git a/tests/kds_s2000w_option_descriptor_tests_run.c b/tests/kds_s2000w_option_descriptor_tests_run.c index f6fca73..23c3871 100644 --- a/tests/kds_s2000w_option_descriptor_tests_run.c +++ b/tests/kds_s2000w_option_descriptor_tests_run.c @@ -34,7 +34,9 @@ int main() cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentyeight_test, setup, teardown), cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentynine_test, setup, teardown), cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_thirdy_test, setup, teardown), - cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_over_max_options_test, setup, teardown) + cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_thirdyone_test, setup, teardown), + cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_over_max_options_test, setup, teardown), + }; return cmocka_run_group_tests(option_descriptor_tests, NULL, NULL); -- 2.39.5