MCPcopy Create free account
hub / github.com/davisking/dlib / pixel_test

Function pixel_test

dlib/test/pixel.cpp:55–868  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53 static_assert(!is_pixel_type<not_a_pixel_type>::value, "bad trait definition");
54
55 void pixel_test (
56 )
57 /*!
58 ensures
59 - runs tests on pixel objects and functions for compliance with the specs
60 !*/
61 {
62
63 print_spinner();
64
65 unsigned char p_gray;
66 unsigned short p_gray16;
67 long p_int;
68 float p_float;
69 signed char p_schar;
70 rgb_pixel p_rgb,p_rgb2;
71 hsi_pixel p_hsi, p_hsi2;
72 hsv_pixel p_hsv, p_hsv2;
73 rgb_alpha_pixel p_rgba;
74 lab_pixel p_lab, p_lab2;
75
76 assign_pixel(p_int, 0.0f);
77 assign_pixel(p_float, 0.0f);
78 assign_pixel(p_schar, 0);
79
80 assign_pixel(p_gray, -2);
81 assign_pixel(p_rgb,0);
82 assign_pixel(p_hsi, -4);
83 assign_pixel(p_hsv, -4);
84 assign_pixel(p_rgba, p_int);
85 assign_pixel(p_gray16,0);
86 assign_pixel(p_lab,-400);
87
88 DLIB_TEST(p_int == 0);
89 DLIB_TEST(p_float == 0);
90 DLIB_TEST(p_schar == 0);
91
92 DLIB_TEST(p_gray == 0);
93 DLIB_TEST(p_gray16 == 0);
94
95 DLIB_TEST(p_rgb.red == 0);
96 DLIB_TEST(p_rgb.green == 0);
97 DLIB_TEST(p_rgb.blue == 0);
98
99 DLIB_TEST(p_rgba.red == 0);
100 DLIB_TEST(p_rgba.green == 0);
101 DLIB_TEST(p_rgba.blue == 0);
102 DLIB_TEST(p_rgba.alpha == 255);
103
104 DLIB_TEST(p_hsi.h == 0);
105 DLIB_TEST(p_hsi.s == 0);
106 DLIB_TEST(p_hsi.i == 0);
107
108 DLIB_TEST(p_hsv.h == 0);
109 DLIB_TEST(p_hsv.s == 0);
110 DLIB_TEST(p_hsv.v == 0);
111
112 DLIB_TEST(p_lab.l == 0);

Callers 1

perform_testMethod · 0.85

Calls 10

print_spinnerFunction · 0.85
assign_pixelFunction · 0.85
vector_to_pixelFunction · 0.85
get_pixel_intensityFunction · 0.85
assign_pixel_intensityFunction · 0.85
serializeFunction · 0.70
deserializeFunction · 0.70
maxFunction · 0.50
minFunction · 0.50
strMethod · 0.45

Tested by

no test coverage detected