]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add option color sharpen
authorBastian Dehn <hhaalo@arcor.de>
Sat, 15 Feb 2025 19:31:36 +0000 (20:31 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 15 Feb 2025 19:31:36 +0000 (20:31 +0100)
src/kds_s2000w_handler_opts.c
src/kds_s2000w_option_descriptors.c
src/kds_s2000w_option_descriptors.h
tests/kds_s2000w_net_get_opt_tests.c
tests/kds_s2000w_option_descriptor_tests.c
tests/kds_s2000w_option_descriptor_tests.h
tests/kds_s2000w_option_descriptor_tests_run.c

index 2f5d578cfc89142f8b3e8ef13e903288d51c63ff..3976aa53cebdcf641cf1e01d2e065adb194b8c8a 100644 (file)
@@ -5,7 +5,7 @@
 #include "kds_s2000w_debug.h"
 
 #define AUTOSTART_ON 1
-#define OPTION_COUNT 22
+#define OPTION_COUNT 23
 
 void _kds_s2000w_handler_opts_write_string_value(json_object* value_object, void* value)
 {
index a563e2d93169a4474ccd931be17e095c75ea3fe9..009faa2143a43cd8cb8da08d8771213d4657851c 100644 (file)
@@ -3,6 +3,8 @@
 #include "kds_s2000w_option_descriptors.h"
 #include "kds_s2000w_debug.h"
 
+#define MAX_OPTION_COUNT 23
+
 SANE_Option_Descriptor* descriptor_array = NULL;
 
 SANE_Word constraint_dpi[] = {5, 100, 150, 200, 300, 600};
@@ -24,6 +26,7 @@ SANE_String_Const* constraint_background_smoothing_mode = NULL;
 SANE_String_Const* constraint_binarization_mode = NULL;
 SANE_String_Const* constraint_max_document_length = NULL;
 SANE_String_Const* constraint_scan_source = NULL;
+SANE_String_Const* constraint_color_sharpen = NULL;
 
 SANE_Option_Descriptor _kds_s2000w_option_descriptor_standard_group()
 {
@@ -491,6 +494,32 @@ SANE_Option_Descriptor _kds_s2000w_option_descriptor_config_reset()
        return descriptor;
 }
 
+SANE_Option_Descriptor _kds_s2000w_option_descriptor_color_sharpen()
+{
+       kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_color_sharpen");
+
+       constraint_color_sharpen = malloc(sizeof(SANE_String_Const*) * 5);
+       constraint_color_sharpen[0] = "None";
+       constraint_color_sharpen[1] = "Normal";
+       constraint_color_sharpen[2] = "High";
+       constraint_color_sharpen[3] = "Exaggerated";
+       constraint_color_sharpen[4] = NULL;
+
+       SANE_Option_Descriptor descriptor = {
+               "colorsharpen",
+               "colorsharpen",
+               "colorsharpen",
+               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_color_sharpen}
+       };
+
+       return descriptor;
+}
+
 void kds_s2000w_option_descriptors_init()
 {
        kds_s2000w_debug_printf(ALL, "kds_s2000w_option_descriptor_init_option_descriptors");
@@ -507,17 +536,18 @@ void kds_s2000w_option_descriptors_init()
        descriptor_array[8] = _kds_s2000w_option_descriptor_color_drop();
        descriptor_array[9] = _kds_s2000w_option_descriptor_color_drop_out_aggressiveness();
        descriptor_array[10] = _kds_s2000w_option_descriptor_color_auto_brightness_mode();
-       descriptor_array[11] = _kds_s2000w_option_descriptor_color_balance_mode();
-       descriptor_array[12] = _kds_s2000w_option_descriptor_color_balancea_agressiveness();
-       descriptor_array[13] = _kds_s2000w_option_descriptor_color_balance_red();
-       descriptor_array[14] = _kds_s2000w_option_descriptor_color_balance_green();
-       descriptor_array[15] = _kds_s2000w_option_descriptor_color_balance_blue();
-       descriptor_array[16] = _kds_s2000w_option_descriptor_foreground_boldness_mode();
-       descriptor_array[17] = _kds_s2000w_option_descriptor_foreground_boldness_aggressiveness();
-       descriptor_array[18] = _kds_s2000w_option_descriptor_background_smoothing_mode();
-       descriptor_array[19] = _kds_s2000w_option_descriptor_background_smoothing_aggressiveness();
-       descriptor_array[20] = _kds_s2000w_option_descriptor_binarization_contrast();
-       descriptor_array[21] = _kds_s2000w_option_descriptor_config_reset();
+       descriptor_array[11] = _kds_s2000w_option_descriptor_color_sharpen();
+       descriptor_array[12] = _kds_s2000w_option_descriptor_color_balance_mode();
+       descriptor_array[13] = _kds_s2000w_option_descriptor_color_balancea_agressiveness();
+       descriptor_array[14] = _kds_s2000w_option_descriptor_color_balance_red();
+       descriptor_array[15] = _kds_s2000w_option_descriptor_color_balance_green();
+       descriptor_array[16] = _kds_s2000w_option_descriptor_color_balance_blue();
+       descriptor_array[17] = _kds_s2000w_option_descriptor_foreground_boldness_mode();
+       descriptor_array[18] = _kds_s2000w_option_descriptor_foreground_boldness_aggressiveness();
+       descriptor_array[19] = _kds_s2000w_option_descriptor_background_smoothing_mode();
+       descriptor_array[20] = _kds_s2000w_option_descriptor_background_smoothing_aggressiveness();
+       descriptor_array[21] = _kds_s2000w_option_descriptor_binarization_contrast();
+       descriptor_array[22] = _kds_s2000w_option_descriptor_config_reset();
 }
 
 void kds_s2000w_option_descriptors_free()
@@ -544,6 +574,8 @@ void kds_s2000w_option_descriptors_free()
        constraint_max_document_length = NULL;
        free(constraint_scan_source);
        constraint_scan_source = NULL;
+       free(constraint_color_sharpen);
+       constraint_color_sharpen = NULL;
        free(descriptor_array);
        descriptor_array = NULL;
 }
index eca41fb9524c08761e87b690bf7ee7d0ffb81d10..edced053cee5870dd3f8cbadd9a2a80382679ce6 100644 (file)
@@ -3,8 +3,6 @@
 #include <stdint.h>
 #include <sane/sane.h>
 
-#define MAX_OPTION_COUNT 22
-
 void kds_s2000w_option_descriptors_init();
 void kds_s2000w_option_descriptors_free();
 
index a77cd17330d46f2d0adbf694f4a2b93b11055ca8..a74549de9ab44e56e02aa6a632b8b57ee7f347ac 100644 (file)
@@ -22,7 +22,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, 22);
+       assert_int_equal(value, 23);
 
        kds_s2000w_handler_free(h);
        h = NULL;
index 7c5fb1133914a81a461151e43130a34a73727902..d3ff6eb5f50a6f0417630379d4f385fc6192c320 100644 (file)
@@ -4,6 +4,8 @@
 #include "kds_s2000w_client_mock.h"
 #include "../src/kds_s2000w_option_descriptors.h"
 
+#define MAX_OPTION_COUNT 23
+
 int setup(void** state)
 {
        kds_s2000w_option_descriptors_init();
@@ -208,6 +210,25 @@ void kds_s2000w_option_get_descriptor_eleven_test()
 {
        SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(11);
 
+       assert_string_equal("colorsharpen", option->name);
+       assert_string_equal("colorsharpen", option->title);
+       assert_string_equal("colorsharpen", 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("None", option->constraint.string_list[0]);
+       assert_string_equal("Normal", option->constraint.string_list[1]);
+       assert_string_equal("High", option->constraint.string_list[2]);
+       assert_string_equal("Exaggerated", option->constraint.string_list[3]);
+       assert_null(option->constraint.string_list[4]);
+}
+
+void kds_s2000w_option_get_descriptor_twelve_test()
+{
+       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(12);
+
        assert_string_equal("colorbalancemode", option->name);
        assert_string_equal("colorbalancemode", option->title);
        assert_string_equal("colorbalancemode", option->desc);
@@ -223,9 +244,9 @@ void kds_s2000w_option_get_descriptor_eleven_test()
        assert_null(option->constraint.string_list[4]);
 }
 
-void kds_s2000w_option_get_descriptor_twelve_test()
+void kds_s2000w_option_get_descriptor_thirdteen_test()
 {
-       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(12);
+       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(13);
 
        assert_string_equal("colorbalanceaggressiveness", option->name);
        assert_string_equal("colorbalanceaggressiveness", option->title);
@@ -240,9 +261,9 @@ void kds_s2000w_option_get_descriptor_twelve_test()
        assert_int_equal(1, option->constraint.range->quant);
 }
 
-void kds_s2000w_option_get_descriptor_thirdteen_test()
+void kds_s2000w_option_get_descriptor_fourteen_test()
 {
-       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(13);
+       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(14);
 
        assert_string_equal("colorbalancered", option->name);
        assert_string_equal("colorbalancered", option->title);
@@ -257,9 +278,9 @@ void kds_s2000w_option_get_descriptor_thirdteen_test()
        assert_int_equal(1, option->constraint.range->quant);
 }
 
-void kds_s2000w_option_get_descriptor_fourteen_test()
+void kds_s2000w_option_get_descriptor_fifteen_test()
 {
-       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(14);
+       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(15);
 
        assert_string_equal("colorbalancegreen", option->name);
        assert_string_equal("colorbalancegreen", option->title);
@@ -274,9 +295,9 @@ void kds_s2000w_option_get_descriptor_fourteen_test()
        assert_int_equal(1, option->constraint.range->quant);
 }
 
-void kds_s2000w_option_get_descriptor_fifteen_test()
+void kds_s2000w_option_get_descriptor_sixteen_test()
 {
-       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(15);
+       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(16);
 
        assert_string_equal("colorbalanceblue", option->name);
        assert_string_equal("colorbalanceblue", option->title);
@@ -291,9 +312,9 @@ void kds_s2000w_option_get_descriptor_fifteen_test()
        assert_int_equal(1, option->constraint.range->quant);
 }
 
-void kds_s2000w_option_get_descriptor_sixteen_test()
+void kds_s2000w_option_get_descriptor_seventeen_test()
 {
-       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(16);
+       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(17);
 
        assert_string_equal("foreground-boldness-mode", option->name);
        assert_string_equal("Foreground Boldness Mode", option->title);
@@ -309,9 +330,9 @@ void kds_s2000w_option_get_descriptor_sixteen_test()
        assert_null(option->constraint.string_list[3]);
 }
 
-void kds_s2000w_option_get_descriptor_seventeen_test()
+void kds_s2000w_option_get_descriptor_eightteen_test()
 {
-       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(17);
+       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(18);
 
        assert_string_equal("foreground-boldness-aggressiveness", option->name);
        assert_string_equal("Foreground Boldness Aggressiveness", option->title);
@@ -326,9 +347,9 @@ void kds_s2000w_option_get_descriptor_seventeen_test()
        assert_int_equal(1, option->constraint.range->quant);
 }
 
-void kds_s2000w_option_get_descriptor_eightteen_test()
+void kds_s2000w_option_get_descriptor_nineteen_test()
 {
-       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(18);
+       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(19);
 
        assert_string_equal("background-smoothing-mode", option->name);
        assert_string_equal("Background Smoothing Mode", option->title);
@@ -344,9 +365,9 @@ void kds_s2000w_option_get_descriptor_eightteen_test()
        assert_null(option->constraint.string_list[3]);
 }
 
-void kds_s2000w_option_get_descriptor_nineteen_test()
+void kds_s2000w_option_get_descriptor_twenty_test()
 {
-       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(19);
+       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(20);
 
        assert_string_equal("background-smoothing-aggressiveness", option->name);
        assert_string_equal("Background Smoothing Aggressivenes", option->title);
@@ -361,9 +382,9 @@ void kds_s2000w_option_get_descriptor_nineteen_test()
        assert_int_equal(1, option->constraint.range->quant);
 }
 
-void kds_s2000w_option_get_descriptor_twenty_test()
+void kds_s2000w_option_get_descriptor_twentyone_test()
 {
-       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(20);
+       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(21);
 
        assert_string_equal(SANE_NAME_CONTRAST, option->name);
        assert_string_equal(SANE_TITLE_CONTRAST, option->title);
@@ -378,9 +399,9 @@ void kds_s2000w_option_get_descriptor_twenty_test()
        assert_int_equal(1, option->constraint.range->quant);
 }
 
-void kds_s2000w_option_get_descriptor_twentyone_test()
+void kds_s2000w_option_get_descriptor_twentytwo_test()
 {
-       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(21);
+       SANE_Option_Descriptor* option = kds_s2000w_option_descriptors_get(22);
 
        assert_string_equal("config-reset", option->name);
        assert_string_equal("reset config", option->title);
index 67080aa25692e4e4bf1c4809a4ef1bf12fa78636..caff54ef6ff71681c29bb2c934cd867c75e7faff 100644 (file)
@@ -30,5 +30,6 @@ void kds_s2000w_option_get_descriptor_eightteen_test();
 void kds_s2000w_option_get_descriptor_nineteen_test();
 void kds_s2000w_option_get_descriptor_twenty_test();
 void kds_s2000w_option_get_descriptor_twentyone_test();
+void kds_s2000w_option_get_descriptor_twentytwo_test();
 void kds_s2000w_option_get_descriptor_over_max_options_test();
 #endif
\ No newline at end of file
index 63c3a01af883ba8691127cc4d534c30eda574be0..9f177a7cea99face1e3586143ee049202804dfcf 100644 (file)
@@ -25,6 +25,7 @@ int main()
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_nineteen_test, setup, teardown),
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twenty_test, setup, teardown),
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentyone_test, setup, teardown),
+               cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_twentytwo_test, setup, teardown),
                cmocka_unit_test_setup_teardown(kds_s2000w_option_get_descriptor_over_max_options_test, setup, teardown)
        };