]>
git.saurik.com Git - wxWidgets.git/blob - tests/graphics/bitmap.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/graphics/bitmap.cpp
3 // Purpose: wxBitmap unit test
4 // Author: Vadim Zeitlin
6 // Copyright: (c) 2010 Vadim Zeitlin <vadim@wxwidgets.org>
7 ///////////////////////////////////////////////////////////////////////////////
9 // ----------------------------------------------------------------------------
11 // ----------------------------------------------------------------------------
19 #include "wx/bitmap.h"
20 #include "wx/dcmemory.h"
22 // ----------------------------------------------------------------------------
24 // ----------------------------------------------------------------------------
26 class BitmapTestCase
: public CppUnit::TestCase
32 virtual void tearDown();
35 CPPUNIT_TEST_SUITE( BitmapTestCase
);
37 CPPUNIT_TEST_SUITE_END();
43 DECLARE_NO_COPY_CLASS(BitmapTestCase
)
46 // register in the unnamed registry so that these tests are run by default
47 CPPUNIT_TEST_SUITE_REGISTRATION( BitmapTestCase
);
49 // also include in its own registry so that these tests can be run alone
50 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( BitmapTestCase
, "BitmapTestCase" );
52 void BitmapTestCase::setUp()
56 wxMemoryDC
dc(m_bmp
);;
57 dc
.SetBackground(*wxWHITE
);
60 dc
.SetBrush(*wxBLACK_BRUSH
);
61 dc
.DrawRectangle(4, 4, 2, 2);
63 dc
.SetPen(*wxRED_PEN
);
64 dc
.DrawLine(0, 0, 10, 10);
65 dc
.DrawLine(10, 0, 0, 10);
68 void BitmapTestCase::tearDown()
73 void BitmapTestCase::Mask()
75 wxMask
*mask
= new wxMask(m_bmp
, *wxBLACK
);
78 // copying masks should work
79 wxMask
*mask2
= new wxMask(*mask
);