1 // This is core/vil/tests/test_pixel_format.cxx
2 #include <iostream>
3 #include "testlib/testlib_test.h"
4 #ifdef _MSC_VER
5 #  include "vcl_msvc_warnings.h"
6 #endif
7 #include "vxl_config.h" // for vxl_byte
8 #include "vil/vil_rgb.h"
9 #include "vil/vil_pixel_format.h"
10 
11 static void
test_pixel_format()12 test_pixel_format()
13 {
14   TEST("vil_pixel_format_of(bool)", vil_pixel_format_of(bool()), VIL_PIXEL_FORMAT_BOOL);
15 
16   TEST("vil_pixel_format_of(float)", vil_pixel_format_of(float()), VIL_PIXEL_FORMAT_FLOAT);
17 
18   TEST("vil_pixel_format_of(vil_rgb<float>) has 3 components",
19        vil_pixel_format_num_components(vil_pixel_format_of(vil_rgb<float>())),
20        3);
21 
22   TEST("vil_pixel_format_component_format(vxl_byte)",
23        vil_pixel_format_component_format(vil_pixel_format_of(vxl_byte())),
24        VIL_PIXEL_FORMAT_BYTE);
25 
26   TEST("vil_pixel_format_component_format(vil_rgba<vxl_byte>)",
27        vil_pixel_format_component_format(vil_pixel_format_of(vil_rgba<vxl_byte>())),
28        VIL_PIXEL_FORMAT_BYTE);
29 
30   std::cout << VIL_PIXEL_FORMAT_RGBA_DOUBLE << '\n'
31             << VIL_PIXEL_FORMAT_RGBA_INT_32 << '\n'
32             << VIL_PIXEL_FORMAT_RGBA_UINT_32 << '\n'
33             << VIL_PIXEL_FORMAT_RGBA_INT_16 << '\n'
34             << VIL_PIXEL_FORMAT_RGBA_UINT_16 << '\n'
35             << VIL_PIXEL_FORMAT_RGBA_BYTE << '\n'
36             << VIL_PIXEL_FORMAT_RGBA_SBYTE << '\n'
37             << VIL_PIXEL_FORMAT_RGBA_FLOAT << '\n'
38             << VIL_PIXEL_FORMAT_RGBA_DOUBLE << std::endl;
39 }
40 
41 TESTMAIN(test_pixel_format);
42