Add wxColour::GetLuminance()
This method can be used to return the perceived brightness of the colour. Closes https://github.com/wxWidgets/wxWidgets/pull/1300
This commit is contained in:
@@ -115,3 +115,10 @@ void ColourTestCase::FromString()
|
||||
CPPUNIT_ASSERT( !wxFromString("rgba(1, 2, 3.456, foo)", &col) );
|
||||
}
|
||||
|
||||
TEST_CASE("wxColour::GetLuminance", "[colour][luminance]")
|
||||
{
|
||||
CHECK( wxBLACK->GetLuminance() == Approx(0.0) );
|
||||
CHECK( wxWHITE->GetLuminance() == Approx(1.0) );
|
||||
CHECK( wxRED->GetLuminance() > 0 );
|
||||
CHECK( wxRED->GetLuminance() < 1 );
|
||||
}
|
||||
|
Reference in New Issue
Block a user