Get rid of CppUnit boilerplate in wxSize unit test
No real changes.
This commit is contained in:
parent
7a03d5fe9b
commit
227b5dba0a
@ -17,65 +17,40 @@
|
||||
#include "wx/gdicmn.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// test class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class SizeTestCase : public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
SizeTestCase() { }
|
||||
|
||||
private:
|
||||
CPPUNIT_TEST_SUITE( SizeTestCase );
|
||||
CPPUNIT_TEST( Operators );
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
void Operators();
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(SizeTestCase);
|
||||
};
|
||||
|
||||
// register in the unnamed registry so that these tests are run by default
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION( SizeTestCase );
|
||||
|
||||
// also include in its own registry so that these tests can be run alone
|
||||
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SizeTestCase, "SizeTestCase" );
|
||||
|
||||
void SizeTestCase::Operators()
|
||||
TEST_CASE("wxSize::Operators", "[size]")
|
||||
{
|
||||
wxSize s1(1,2);
|
||||
wxSize s2(3,4);
|
||||
wxSize s3;
|
||||
|
||||
s3 = s1 + s2;
|
||||
CPPUNIT_ASSERT( s3.GetWidth()==4 );
|
||||
CPPUNIT_ASSERT( s3.GetHeight()==6 );
|
||||
CHECK( s3.GetWidth()==4 );
|
||||
CHECK( s3.GetHeight()==6 );
|
||||
s3 = s2 - s1;
|
||||
CPPUNIT_ASSERT( s3.GetWidth()==2 );
|
||||
CPPUNIT_ASSERT( s3.GetHeight()==2 );
|
||||
CHECK( s3.GetWidth()==2 );
|
||||
CHECK( s3.GetHeight()==2 );
|
||||
s3 = s1 * 2;
|
||||
CPPUNIT_ASSERT( s3.GetWidth()==2 );
|
||||
CPPUNIT_ASSERT( s3.GetHeight()==4 );
|
||||
CHECK( s3.GetWidth()==2 );
|
||||
CHECK( s3.GetHeight()==4 );
|
||||
s3 = 2 * s1;
|
||||
CPPUNIT_ASSERT( s3.GetWidth()==2 );
|
||||
CPPUNIT_ASSERT( s3.GetHeight()==4 );
|
||||
CHECK( s3.GetWidth()==2 );
|
||||
CHECK( s3.GetHeight()==4 );
|
||||
s3 = s3 / 2;
|
||||
CPPUNIT_ASSERT( s3.GetWidth()==1 );
|
||||
CPPUNIT_ASSERT( s3.GetHeight()==2 );
|
||||
CHECK( s3.GetWidth()==1 );
|
||||
CHECK( s3.GetHeight()==2 );
|
||||
|
||||
s3 = s2;
|
||||
CPPUNIT_ASSERT( s3 != s1 );
|
||||
CHECK( s3 != s1 );
|
||||
s3 = s1;
|
||||
CPPUNIT_ASSERT( s3 == s1 );
|
||||
CHECK( s3 == s1 );
|
||||
s3 += s2;
|
||||
CPPUNIT_ASSERT( s3.GetWidth()==4 );
|
||||
CPPUNIT_ASSERT( s3.GetHeight()==6 );
|
||||
CHECK( s3.GetWidth()==4 );
|
||||
CHECK( s3.GetHeight()==6 );
|
||||
s3 -= s2;
|
||||
CPPUNIT_ASSERT( s3 == s1 );
|
||||
CHECK( s3 == s1 );
|
||||
s3 *= 2;
|
||||
CPPUNIT_ASSERT( s3.GetWidth()==2 );
|
||||
CPPUNIT_ASSERT( s3.GetHeight()==4 );
|
||||
CHECK( s3.GetWidth()==2 );
|
||||
CHECK( s3.GetHeight()==4 );
|
||||
s3 /= 2;
|
||||
CPPUNIT_ASSERT( s3 == s1 );
|
||||
CHECK( s3 == s1 );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user