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:
parent
a18e00379e
commit
9941531efc
1 changed files with 9 additions and 14 deletions
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue