Disable antialiasing in unit test
In order to examine real colors of pixels we need to have unmodified (aliased) edges between regions drawn with different colors. For for wxDCs backed by wxGraphicsContext (e.g. under wxGTK3) antialiasing is enabled by default and to prevent falsifying pixel colors we have to disable it prior to drawing operations. See #17666.
This commit is contained in:
parent
34e19a7449
commit
f171d48be4
@ -19,6 +19,9 @@
|
||||
#include "wx/bitmap.h"
|
||||
#include "wx/rawbmp.h"
|
||||
#include "wx/dcmemory.h"
|
||||
#if wxUSE_GRAPHICS_CONTEXT
|
||||
#include "wx/graphics.h"
|
||||
#endif // wxUSE_GRAPHICS_CONTEXT
|
||||
|
||||
#define ASSERT_EQUAL_RGB(c, r, g, b) \
|
||||
CPPUNIT_ASSERT_EQUAL( r, (int)c.Red() ); \
|
||||
@ -95,6 +98,14 @@ void BitmapTestCase::OverlappingBlit()
|
||||
// Clear to white.
|
||||
{
|
||||
wxMemoryDC dc(m_bmp);
|
||||
#if wxUSE_GRAPHICS_CONTEXT
|
||||
wxGraphicsContext* gc = dc.GetGraphicsContext();
|
||||
if ( gc )
|
||||
{
|
||||
gc->SetAntialiasMode(wxANTIALIAS_NONE);
|
||||
}
|
||||
#endif // wxUSE_GRAPHICS_CONTEXT
|
||||
|
||||
dc.SetBackground( *wxWHITE );
|
||||
dc.Clear();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user