KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_color4d.cpp File Reference
#include <boost/test/unit_test.hpp>
#include "color4d_test_utils.h"
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <gal/color4d.h>
#include <wx/colour.h>

Go to the source code of this file.

Classes

struct  COLOR_SCALAR_CASE
 Test case data for a test that takes a colour and a scalar factor and returns a result. More...
 
struct  FROM_HSV_TO_HEX_CASE
 
struct  FROM_HSL_TO_HEX_CASE
 
struct  WX_CONV_CASE
 

Functions

 BOOST_AUTO_TEST_CASE (BasicOps)
 Declares a struct as the Boost test fixture.
 
 BOOST_AUTO_TEST_CASE (Invert)
 Check inversion.
 
 BOOST_AUTO_TEST_CASE (Brighten)
 Check inversion.
 
 BOOST_AUTO_TEST_CASE (Darken)
 Check darken.
 
 BOOST_AUTO_TEST_CASE (WithAlpha)
 Check alpha setting.
 
 BOOST_AUTO_TEST_CASE (FromHsv)
 Check FromHSV.
 
 BOOST_AUTO_TEST_CASE (FromHsl)
 Check FromHSL.
 
 BOOST_AUTO_TEST_CASE (ToWx)
 Check conversion to WxColour.
 
 BOOST_AUTO_TEST_CASE (FromWx)
 Check conversion from WxColour.
 
 BOOST_AUTO_TEST_CASE (Compare)
 Check the Compare method and hashing.
 

Variables

static std::vector< WX_CONV_CASEwx_conv_cases
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/10]

BOOST_AUTO_TEST_CASE ( BasicOps  )

Declares a struct as the Boost test fixture.

Check basic setting and getting of values

Definition at line 47 of file test_color4d.cpp.

◆ BOOST_AUTO_TEST_CASE() [2/10]

BOOST_AUTO_TEST_CASE ( Brighten  )

Check inversion.

Definition at line 107 of file test_color4d.cpp.

◆ BOOST_AUTO_TEST_CASE() [3/10]

BOOST_AUTO_TEST_CASE ( Compare  )

Check the Compare method and hashing.

Definition at line 312 of file test_color4d.cpp.

References KIGFX::COLOR4D::a, KIGFX::COLOR4D::b, KIGFX::COLOR4D::Compare(), KIGFX::COLOR4D::g, and KIGFX::COLOR4D::r.

◆ BOOST_AUTO_TEST_CASE() [4/10]

BOOST_AUTO_TEST_CASE ( Darken  )

Check darken.

Definition at line 131 of file test_color4d.cpp.

◆ BOOST_AUTO_TEST_CASE() [5/10]

BOOST_AUTO_TEST_CASE ( FromHsl  )

Check FromHSL.

Definition at line 231 of file test_color4d.cpp.

References KIGFX::COLOR4D::FromHSL(), and KI_TEST::IsColorNearHex().

◆ BOOST_AUTO_TEST_CASE() [6/10]

BOOST_AUTO_TEST_CASE ( FromHsv  )

Check FromHSV.

Definition at line 189 of file test_color4d.cpp.

References KIGFX::COLOR4D::FromHSV(), and KI_TEST::IsColorNearHex().

◆ BOOST_AUTO_TEST_CASE() [7/10]

BOOST_AUTO_TEST_CASE ( FromWx  )

Check conversion from WxColour.

Definition at line 296 of file test_color4d.cpp.

References KI_TEST::IsColorNear(), and wx_conv_cases.

◆ BOOST_AUTO_TEST_CASE() [8/10]

BOOST_AUTO_TEST_CASE ( Invert  )

Check inversion.

Definition at line 83 of file test_color4d.cpp.

◆ BOOST_AUTO_TEST_CASE() [9/10]

BOOST_AUTO_TEST_CASE ( ToWx  )

Check conversion to WxColour.

Definition at line 278 of file test_color4d.cpp.

References wx_conv_cases.

◆ BOOST_AUTO_TEST_CASE() [10/10]

BOOST_AUTO_TEST_CASE ( WithAlpha  )

Check alpha setting.

Definition at line 155 of file test_color4d.cpp.

Variable Documentation

◆ wx_conv_cases

std::vector<WX_CONV_CASE> wx_conv_cases
static
Initial value:
= {
{ { 0x00, 0x00, 0x00, 0x00 }, { 0.0, 0.0, 0.0, 0.0 } },
{ { 0x66, 0x80, 0x99, 0xB3 }, { 0.4, 0.5, 0.6, 0.7 } },
{ { 0xFF, 0xFF, 0xFF, 0xFF }, { 1.0, 1.0, 1.0, 1.0 } },
{ { 0xFF, 0x00, 0x00, 0xFF }, { 0.999, 0.001, 0.0, 1.0 } },
}

Definition at line 267 of file test_color4d.cpp.

Referenced by BOOST_AUTO_TEST_CASE().