]>
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
7 // Copyright: (c) 2010 Vadim Zeitlin <vadim@wxwidgets.org>
8 ///////////////////////////////////////////////////////////////////////////////
10 // ----------------------------------------------------------------------------
12 // ----------------------------------------------------------------------------
20 #include "wx/bitmap.h"
21 #include "wx/dcmemory.h"
23 // ----------------------------------------------------------------------------
25 // ----------------------------------------------------------------------------
27 class BitmapTestCase
: public CppUnit::TestCase
33 virtual void tearDown();
36 CPPUNIT_TEST_SUITE( BitmapTestCase
);
38 CPPUNIT_TEST_SUITE_END();
44 DECLARE_NO_COPY_CLASS(BitmapTestCase
)
47 // register in the unnamed registry so that these tests are run by default
48 CPPUNIT_TEST_SUITE_REGISTRATION( BitmapTestCase
);
50 // also include in its own registry so that these tests can be run alone
51 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( BitmapTestCase
, "BitmapTestCase" );
53 void BitmapTestCase::setUp()
57 wxMemoryDC
dc(m_bmp
);;
58 dc
.SetBackground(*wxWHITE
);
61 dc
.SetBrush(*wxBLACK_BRUSH
);
62 dc
.DrawRectangle(4, 4, 2, 2);
64 dc
.SetPen(*wxRED_PEN
);
65 dc
.DrawLine(0, 0, 10, 10);
66 dc
.DrawLine(10, 0, 0, 10);
69 void BitmapTestCase::tearDown()
74 void BitmapTestCase::Mask()
76 wxMask
*mask
= new wxMask(m_bmp
, *wxBLACK
);
79 // copying masks should work
80 wxMask
*mask2
= new wxMask(*mask
);