]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add option descriptor for transport handling
authorBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 08:30:00 +0000 (09:30 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 08:30:00 +0000 (09:30 +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 84efe63b9f5488efbdeaaecd198027b616133a2d..f4f0b3926ea025bca53b23ecf387c10b6720027c 100644 (file)
@@ -3,7 +3,7 @@
 #include "kds_s2000w_option_descriptors.h"
 #include "kds_s2000w_debug.h"
 
-#define MAX_OPTION_COUNT 28
+#define MAX_OPTION_COUNT 29
 
 SANE_Option_Descriptor* descriptor_array = NULL;
 
@@ -32,6 +32,7 @@ SANE_String_Const* constraint_multifeed_response = NULL;
 SANE_String_Const* constraint_post_scan_rotation = NULL;
 SANE_String_Const* constraint_edge_fill = NULL;
 SANE_String_Const* constraint_image_border = NULL;
+SANE_String_Const* constraint_transport_handling = NULL;
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_standard_group()
 {
@@ -652,6 +653,33 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_image_border()
        return descriptor;
 }
 
+SANE_Option_Descriptor _kds_s2000w_option_descriptor_transport_handling()
+{
+       kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_transport_handling");
+
+       constraint_transport_handling = malloc(sizeof(SANE_String_Const*) * 5);
+       constraint_transport_handling[0] = "Normal";
+       constraint_transport_handling[1] = "ImprovedStacking";
+       constraint_transport_handling[2] = "BestStacking";
+       constraint_transport_handling[3] = "Special";
+       constraint_transport_handling[4] = NULL;
+
+       SANE_Option_Descriptor descriptor = {
+               "transport-handling",
+               "Transport Handling",
+               "Transport Handling",
+               SANE_TYPE_STRING,
+               SANE_UNIT_NONE,
+               sizeof(SANE_String_Const*) * 5,
+               SANE_CAP_SOFT_DETECT | SANE_CAP_SOFT_SELECT,
+               SANE_CONSTRAINT_STRING_LIST,
+               {.string_list = constraint_transport_handling}
+       };
+
+       return descriptor;
+}
+
+
 void kds_s2000w_option_descriptors_init()
 {
        kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_init_option_descriptors");
@@ -684,7 +712,8 @@ void kds_s2000w_option_descriptors_init()
        descriptor_array[24] = _kds_s2000w_option_descriptor_post_scan_rotation();
        descriptor_array[25] = _kds_s2000w_option_descriptor_edge_fill();
        descriptor_array[26] = _kds_s2000w_option_descriptor_image_border();
-       descriptor_array[27] = _kds_s2000w_option_descriptor_config_reset();
+       descriptor_array[27] = _kds_s2000w_option_descriptor_transport_handling();
+       descriptor_array[28] = _kds_s2000w_option_descriptor_config_reset();
 }
 
 void kds_s2000w_option_descriptors_free()
@@ -723,6 +752,8 @@ void kds_s2000w_option_descriptors_free()
        constraint_edge_fill = NULL;
        free(constraint_image_border);
        constraint_image_border = NULL;
+       free(constraint_transport_handling);
+       constraint_transport_handling = NULL;
        free(descriptor_array);
        descriptor_array = NULL;
 }
index e91461191c4f9804ed97e22f849c435bee9ca4f2..9864eb4fdbaa17884ca12c4fc7d349d0b22bbf7f 100644 (file)
@@ -4,7 +4,7 @@
 #include "kds_s2000w_client_mock.h"
 #include "../src/kds_s2000w_option_descriptors.h"
 
-#define MAX_OPTION_COUNT 28
+#define MAX_OPTION_COUNT 29
 
 int setup(void** state)
 {
@@ -495,6 +495,25 @@ void kds_s2000w_option_get_descriptor_twentyseven_test()
 {
        SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(27);
 
+       assert_string_equal("transport-handling", option->name);
+       assert_string_equal("Transport Handling", option->title);
+       assert_string_equal("Transport Handling", 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*) * 5, 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("Normal", option->constraint.string_list[0]);
+       assert_string_equal("ImprovedStacking", option->constraint.string_list[1]);
+       assert_string_equal("BestStacking", option->constraint.string_list[2]);
+       assert_string_equal("Special", option->constraint.string_list[3]);
+       assert_null(option->constraint.string_list[4]);
+}
+
+void kds_s2000w_option_get_descriptor_twentyeight_test()
+{
+       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(28);
+
        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 a4d13829006ed6cb0ed103315f440b17e5188513..383c80c3cbfa90ec7cdeb4c8e7c11980b0065b13 100644 (file)
@@ -35,5 +35,7 @@ void kds_s2000w_option_get_descriptor_twentythree_test();
 void kds_s2000w_option_get_descriptor_twentyfour_test();
 void kds_s2000w_option_get_descriptor_twentyfive_test();
 void kds_s2000w_option_get_descriptor_twentysix_test();
+void kds_s2000w_option_get_descriptor_twentyseven_test();
+void kds_s2000w_option_get_descriptor_twentyeight_test();
 void kds_s2000w_option_get_descriptor_over_max_options_test();
 #endif
\ No newline at end of file
index ccb25b209455461a7af554ff9bd396c926562754..ad8cb8479bb04867e8d41e1d3a236aa74aa2fa7e 100644 (file)
@@ -30,6 +30,8 @@ int main()
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentyfour_test, setup, teardown),
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentyfive_test, setup, teardown),
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentysix_test, setup, teardown),
+               cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentyseven_test, setup, teardown),
+               cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentyeight_test, setup, teardown),
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_over_max_options_test, setup, teardown)
        };