]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add option descriptor for document feeder timeout
authorBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 17:26:44 +0000 (18:26 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 17:26:44 +0000 (18:26 +0100)
src/kds_s2000w_option_descriptors.c
tests/kds_s2000w_option_descriptor_tests.c
tests/kds_s2000w_option_descriptor_tests.h
tests/kds_s2000w_option_descriptor_tests_run.c

index 0c3a229b255097374a7aeb201355e99b363fe402..8345a7094f90ed840b177d6dcd59398f81b6e61a 100644 (file)
@@ -4,7 +4,7 @@
 #include "kds_s2000w_option_descriptors.h"
 #include "kds_s2000w_debug.h"
 
-#define MAX_OPTION_COUNT 37
+#define MAX_OPTION_COUNT 38
 
 SANE_Option_Descriptor* descriptor_array = NULL;
 
@@ -893,6 +893,30 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_max_document_length()
        return descriptor;
 }
 
+SANE_Option_Descriptor _kds_s2000w_option_descriptor_document_feeder_timeout()
+{
+       kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_max_document_length");
+
+       SANE_Range* constraint = malloc(sizeof(SANE_Range));
+       constraint->min = 0;
+       constraint->max = 120;
+       constraint->quant = 1;
+
+       SANE_Option_Descriptor descriptor = {
+               "document-feeder-timeout",
+               "Document feeder timeout",
+               "Document feeder timeout",
+               SANE_TYPE_INT,
+               SANE_UNIT_NONE,
+               sizeof(SANE_Int),
+               SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT,
+               SANE_CONSTRAINT_RANGE,
+               {.range = constraint}
+       };
+
+       return descriptor;
+}
+
 void kds_s2000w_option_descriptors_init()
 {
        kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_init_option_descriptors");
@@ -934,7 +958,8 @@ void kds_s2000w_option_descriptors_init()
        descriptor_array[33] = _kds_s2000w_option_descriptor_skip_blank_page_content();
        descriptor_array[34] = _kds_s2000w_option_descriptor_color_brightness();
        descriptor_array[35] = _kds_s2000w_option_descriptor_max_document_length();
-       descriptor_array[36] = _kds_s2000w_option_descriptor_config_reset();
+       descriptor_array[36] = _kds_s2000w_option_descriptor_document_feeder_timeout();
+       descriptor_array[37] = _kds_s2000w_option_descriptor_config_reset();
 }
 
 void kds_s2000w_option_descriptors_free()
index 91b1e5f9be6f2d0588917656e8b0b42ca63f15c0..48e342f482af45b08c96dc68ffdd7c0455372e07 100644 (file)
@@ -4,7 +4,7 @@
 #include "kds_s2000w_client_mock.h"
 #include "../src/kds_s2000w_option_descriptors.h"
 
-#define MAX_OPTION_COUNT 37
+#define MAX_OPTION_COUNT 38
 
 int setup(void** state)
 {
@@ -653,6 +653,23 @@ void kds_s2000w_option_get_descriptor_thirdysix_test()
 {
        SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(36);
 
+       assert_string_equal("document-feeder-timeout", option->name);
+       assert_string_equal("Document feeder timeout", option->title);
+       assert_string_equal("Document feeder timeout", option->desc);
+       assert_int_equal(SANE_TYPE_INT, option->type);
+       assert_int_equal(SANE_UNIT_NONE, option->unit);
+       assert_int_equal(sizeof(SANE_Int), option->size);
+       assert_int_equal(SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT, option->cap);
+       assert_int_equal(SANE_CONSTRAINT_RANGE, option->constraint_type);
+       assert_int_equal(option->constraint.range->min, 0);
+       assert_int_equal(option->constraint.range->max, 120);
+       assert_int_equal(option->constraint.range->quant, 1);
+}
+
+void kds_s2000w_option_get_descriptor_thirdyseven_test()
+{
+       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(37);
+
        assert_string_equal("config-reset", option->name);
        assert_string_equal("reset config", option->title);
        assert_string_equal("load default configuration from scanner", option->desc);
index 6f76784e16072c2fd9481c1fc16e9664cd3571b7..a2b1e2c64260833d7146cf7eeba9ab62e5053a2e 100644 (file)
@@ -45,6 +45,7 @@ void kds_s2000w_option_get_descriptor_thirdythree_test();
 void kds_s2000w_option_get_descriptor_thirdyfour_test();
 void kds_s2000w_option_get_descriptor_thirdyfive_test();
 void kds_s2000w_option_get_descriptor_thirdysix_test();
+void kds_s2000w_option_get_descriptor_thirdyseven_test();
 void kds_s2000w_option_get_descriptor_get_by_name_test();
 void kds_s2000w_option_get_descriptor_over_max_options_test();
 #endif
\ No newline at end of file
index e782077c715b636ecb41494a09b93bb55f796cdc..3c87444b61cc0946b100777edd970a68b8c632e3 100644 (file)
@@ -40,6 +40,7 @@ int main()
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_thirdyfour_test, setup, teardown),
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_thirdyfive_test, setup, teardown),
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_thirdysix_test, setup, teardown),
+               cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_thirdyseven_test, setup, teardown),
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_get_by_name_test, setup, teardown),
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_over_max_options_test, setup, teardown),
        };