2004-12-14 15:29:20 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: tests/geometry/size.cpp
|
|
|
|
// Purpose: wxSize unit test
|
2004-12-14 15:29:21 -05:00
|
|
|
// Author: Wlodzimierz ABX Skiba
|
2004-12-14 15:29:20 -05:00
|
|
|
// Created: 2004-12-14
|
|
|
|
// Copyright: (c) 2004 wxWindows
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "testprec.h"
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef WX_PRECOMP
|
|
|
|
#include "wx/gdicmn.h"
|
|
|
|
#endif // WX_PRECOMP
|
|
|
|
|
2021-11-20 16:01:31 -05:00
|
|
|
#include "asserthelper.h"
|
|
|
|
|
2021-11-20 15:52:59 -05:00
|
|
|
TEST_CASE("wxSize::Operators", "[size]")
|
2004-12-14 15:29:20 -05:00
|
|
|
{
|
|
|
|
wxSize s1(1,2);
|
|
|
|
wxSize s2(3,4);
|
|
|
|
wxSize s3;
|
|
|
|
|
|
|
|
s3 = s1 + s2;
|
2021-11-20 16:01:31 -05:00
|
|
|
CHECK( s3 == wxSize(4, 6) );
|
2004-12-14 15:29:20 -05:00
|
|
|
s3 = s2 - s1;
|
2021-11-20 16:01:31 -05:00
|
|
|
CHECK( s3 == wxSize(2, 2) );
|
2004-12-14 15:29:20 -05:00
|
|
|
s3 = s1 * 2;
|
2021-11-20 16:01:31 -05:00
|
|
|
CHECK( s3 == wxSize(2, 4) );
|
2007-05-23 21:47:29 -04:00
|
|
|
s3 = 2 * s1;
|
2021-11-20 16:01:31 -05:00
|
|
|
CHECK( s3 == wxSize(2, 4) );
|
2004-12-14 15:29:20 -05:00
|
|
|
s3 = s3 / 2;
|
2021-11-20 16:01:31 -05:00
|
|
|
CHECK( s3 == wxSize(1, 2) );
|
2004-12-14 15:29:20 -05:00
|
|
|
|
|
|
|
s3 = s2;
|
2021-11-20 15:52:59 -05:00
|
|
|
CHECK( s3 != s1 );
|
2004-12-14 15:29:20 -05:00
|
|
|
s3 = s1;
|
2021-11-20 15:52:59 -05:00
|
|
|
CHECK( s3 == s1 );
|
2004-12-14 15:29:20 -05:00
|
|
|
s3 += s2;
|
2021-11-20 16:01:31 -05:00
|
|
|
CHECK( s3 == wxSize(4, 6) );
|
2004-12-14 15:29:20 -05:00
|
|
|
s3 -= s2;
|
2021-11-20 15:52:59 -05:00
|
|
|
CHECK( s3 == s1 );
|
2004-12-14 15:29:20 -05:00
|
|
|
s3 *= 2;
|
2021-11-20 16:01:31 -05:00
|
|
|
CHECK( s3 == wxSize(2, 4) );
|
2004-12-14 15:29:20 -05:00
|
|
|
s3 /= 2;
|
2021-11-20 15:52:59 -05:00
|
|
|
CHECK( s3 == s1 );
|
2021-11-20 16:06:28 -05:00
|
|
|
|
|
|
|
CHECK( wxSize(6, 9) / 1.5 == wxSize(4, 6) );
|
2004-12-14 15:29:20 -05:00
|
|
|
}
|