]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add option descriptor skip blank page content
authorBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 13:11:52 +0000 (14:11 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 16 Feb 2025 13:11:52 +0000 (14:11 +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 b7c6b6efe0cdec9bbe591d479c91a23885f61084..d058484c0fd8da2ac5c5b4181f8792a31948f7e5 100644 (file)
@@ -3,7 +3,7 @@
 #include "kds_s2000w_option_descriptors.h"
 #include "kds_s2000w_debug.h"
 
-#define MAX_OPTION_COUNT 34
+#define MAX_OPTION_COUNT 35
 
 SANE_Option_Descriptor* descriptor_array = NULL;
 
@@ -756,7 +756,6 @@ 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",
@@ -821,6 +820,30 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_cropping_image()
        return descriptor;
 }
 
+SANE_Option_Descriptor _kds_s2000w_option_descriptor_skip_blank_page_content()
+{
+       kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_skip_blank_page_content");
+
+       SANE_Range* constraint = malloc(sizeof(SANE_Range));
+       constraint->min = 0;
+       constraint->max = 100;
+       constraint->quant = 1;
+
+       SANE_Option_Descriptor descriptor = {
+               "skip-blank-page-content",
+               "skip blank page content",
+               "skip blank page content",
+               SANE_TYPE_INT,
+               SANE_UNIT_PERCENT,
+               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");
@@ -859,7 +882,8 @@ void kds_s2000w_option_descriptors_init()
        descriptor_array[30] = _kds_s2000w_option_descriptor_hole_fill();
        descriptor_array[31] = _kds_s2000w_option_descriptor_cropping_mode();
        descriptor_array[32] = _kds_s2000w_option_descriptor_cropping_image();
-       descriptor_array[33] = _kds_s2000w_option_descriptor_config_reset();
+       descriptor_array[33] = _kds_s2000w_option_descriptor_skip_blank_page_content();
+       descriptor_array[34] = _kds_s2000w_option_descriptor_config_reset();
 }
 
 void kds_s2000w_option_descriptors_free()
index 19a3435da39cd0b6c083bbc638daffeccb4bc4e1..39f201c2456be4ab6186b63b1342f9663bb8bd49 100644 (file)
@@ -4,7 +4,7 @@
 #include "kds_s2000w_client_mock.h"
 #include "../src/kds_s2000w_option_descriptors.h"
 
-#define MAX_OPTION_COUNT 34
+#define MAX_OPTION_COUNT 35
 
 int setup(void** state)
 {
@@ -602,6 +602,23 @@ void kds_s2000w_option_get_descriptor_thirdythree_test()
 {
        SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(33);
 
+       assert_string_equal("skip-blank-page-content", option->name);
+       assert_string_equal("skip blank page content", option->title);
+       assert_string_equal("skip blank page content", option->desc);
+       assert_int_equal(SANE_TYPE_INT, option->type);
+       assert_int_equal(SANE_UNIT_PERCENT, 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, 100);
+       assert_int_equal(option->constraint.range->quant, 1);
+}
+
+void kds_s2000w_option_get_descriptor_thirdyfour_test()
+{
+       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(34);
+
        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 533b4b552c4926e056531faf0fce6a15c5f33852..4f83d672de911be6f5db2481a301d99ab3ceccdb 100644 (file)
@@ -42,5 +42,6 @@ void kds_s2000w_option_get_descriptor_thirdy_test();
 void kds_s2000w_option_get_descriptor_thirdyone_test();
 void kds_s2000w_option_get_descriptor_thirdytwo_test();
 void kds_s2000w_option_get_descriptor_thirdythree_test();
+void kds_s2000w_option_get_descriptor_thirdyfour_test();
 void kds_s2000w_option_get_descriptor_over_max_options_test();
 #endif
\ No newline at end of file
index b06608ef07287007b92fbc8f37c563a40c947718..724bdeb52100fdbca2c7f70397679d025e68ffb6 100644 (file)
@@ -37,6 +37,7 @@ int main()
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_thirdyone_test, setup, teardown),
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_thirdytwo_test, setup, teardown),
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_thirdythree_test, setup, teardown),
+               cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_thirdyfour_test, setup, teardown),
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_over_max_options_test, setup, teardown),
        };