32 #include "DGtal/base/Common.h" 33 #include "ConfigTest.h" 34 #include "DGtal/helpers/StdDefs.h" 35 #include "DGtal/io/Color.h" 39 using namespace DGtal;
50 unsigned int nbok = 0;
56 Color g(32,32,32,255);
57 Color gg(64,64,64,255);
58 Color w(255,255,255,255);
60 trace.
info() <<
" B+G = g "<< b+g<<std::endl;
61 nbok += ((b+g)==g) ? 1 : 0;
63 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 64 <<
"add" << std::endl;
66 trace.
info() <<
" g+g = gg "<< g*2<<
" expected ="<<gg<<std::endl;
67 nbok += ((g+g)==gg) ? 1 : 0;
69 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 70 <<
"add (bis)" << std::endl;
72 trace.
info() <<
" W+W = w "<< w+w<<std::endl;
73 nbok += ((w+w)==w) ? 1 : 0;
75 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 76 <<
"max " << std::endl;
78 trace.
info() <<
" g*2 = gg "<< g*2<<
" expected ="<<gg<<std::endl;
79 nbok += ((g*2)==gg) ? 1 : 0;
81 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 82 <<
"coeff" << std::endl;
84 trace.
info() <<
" 1.*red = red "<< 1.0*Color::Red<<
" expected ="<<Color::Red<<std::endl;
85 nbok += ((1.0*Color::Red)==Color::Red) ? 1 : 0;
87 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 88 <<
"coeff" << std::endl;
90 trace.
info() <<
" 2*g = gg "<< 2.0*g<<
" expected ="<<gg<<std::endl;
91 nbok += ((2*g)==gg) ? 1 : 0;
93 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 94 <<
"coeff" << std::endl;
100 #ifdef COLOR_WITH_ALPHA_ARITH 101 trace.
info() <<
" a+aa = "<< a+aa<<std::endl;
102 nbok += (c ==
Color(0,0,0,96)) ? 1 : 0;
104 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 105 <<
"alpha arith (enabled)" << std::endl;
107 trace.
info() <<
" a+aa = "<< a+aa<<std::endl;
108 nbok += (c ==
Color(0,0,0,64)) ? 1 : 0;
110 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 111 <<
"alpha arith (disabled)" << std::endl;
116 val += 1.0*Color::Red;
117 trace.
info() <<
" val == Color::Red "<< val<<std::endl;
118 nbok += (val==Color::Red) ? 1 : 0;
120 trace.
info() <<
"(" << nbok <<
"/" << nb <<
") " 121 <<
"red" << std::endl;
133 int main(
int argc,
char** argv )
137 for (
int i = 0; i < argc; ++i )
142 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
void beginBlock(const std::string &keyword="")
Color & setRGBi(const unsigned char aRedValue, const unsigned char aGreenValue, const unsigned char aBlueValue, const unsigned char aAlphaValue)
DGtal is the top-level namespace which contains all DGtal functions and types.
Structure representing an RGB triple with alpha component.
int main(int argc, char **argv)