Simplify wxSize unit test further by comparing wxSizes directly
This is shorter and more clear than comparing width and height independently and results in just as informative messages in case of test failure if asserthelper.h is included.
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
#include "wx/gdicmn.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "asserthelper.h"
|
||||
|
||||
TEST_CASE("wxSize::Operators", "[size]")
|
||||
{
|
||||
wxSize s1(1,2);
|
||||
@@ -24,33 +26,26 @@ TEST_CASE("wxSize::Operators", "[size]")
|
||||
wxSize s3;
|
||||
|
||||
s3 = s1 + s2;
|
||||
CHECK( s3.GetWidth()==4 );
|
||||
CHECK( s3.GetHeight()==6 );
|
||||
CHECK( s3 == wxSize(4, 6) );
|
||||
s3 = s2 - s1;
|
||||
CHECK( s3.GetWidth()==2 );
|
||||
CHECK( s3.GetHeight()==2 );
|
||||
CHECK( s3 == wxSize(2, 2) );
|
||||
s3 = s1 * 2;
|
||||
CHECK( s3.GetWidth()==2 );
|
||||
CHECK( s3.GetHeight()==4 );
|
||||
CHECK( s3 == wxSize(2, 4) );
|
||||
s3 = 2 * s1;
|
||||
CHECK( s3.GetWidth()==2 );
|
||||
CHECK( s3.GetHeight()==4 );
|
||||
CHECK( s3 == wxSize(2, 4) );
|
||||
s3 = s3 / 2;
|
||||
CHECK( s3.GetWidth()==1 );
|
||||
CHECK( s3.GetHeight()==2 );
|
||||
CHECK( s3 == wxSize(1, 2) );
|
||||
|
||||
s3 = s2;
|
||||
CHECK( s3 != s1 );
|
||||
s3 = s1;
|
||||
CHECK( s3 == s1 );
|
||||
s3 += s2;
|
||||
CHECK( s3.GetWidth()==4 );
|
||||
CHECK( s3.GetHeight()==6 );
|
||||
CHECK( s3 == wxSize(4, 6) );
|
||||
s3 -= s2;
|
||||
CHECK( s3 == s1 );
|
||||
s3 *= 2;
|
||||
CHECK( s3.GetWidth()==2 );
|
||||
CHECK( s3.GetHeight()==4 );
|
||||
CHECK( s3 == wxSize(2, 4) );
|
||||
s3 /= 2;
|
||||
CHECK( s3 == s1 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user