wxWidgets/tests/geometry/size.cpp
Vadim Zeitlin 2bbe126dca Add operator/(wxSize, double)
For some reason, while both operator*(wxSize, double) and
wxSize::operator/=(double) existed, this one did not, which was
unexpected, so add it too.
2021-11-20 22:06:28 +01:00

54 lines
1.2 KiB
C++

///////////////////////////////////////////////////////////////////////////////
// Name: tests/geometry/size.cpp
// Purpose: wxSize unit test
// Author: Wlodzimierz ABX Skiba
// Created: 2004-12-14
// Copyright: (c) 2004 wxWindows
///////////////////////////////////////////////////////////////////////////////
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
#include "testprec.h"
#ifndef WX_PRECOMP
#include "wx/gdicmn.h"
#endif // WX_PRECOMP
#include "asserthelper.h"
TEST_CASE("wxSize::Operators", "[size]")
{
wxSize s1(1,2);
wxSize s2(3,4);
wxSize s3;
s3 = s1 + s2;
CHECK( s3 == wxSize(4, 6) );
s3 = s2 - s1;
CHECK( s3 == wxSize(2, 2) );
s3 = s1 * 2;
CHECK( s3 == wxSize(2, 4) );
s3 = 2 * s1;
CHECK( s3 == wxSize(2, 4) );
s3 = s3 / 2;
CHECK( s3 == wxSize(1, 2) );
s3 = s2;
CHECK( s3 != s1 );
s3 = s1;
CHECK( s3 == s1 );
s3 += s2;
CHECK( s3 == wxSize(4, 6) );
s3 -= s2;
CHECK( s3 == s1 );
s3 *= 2;
CHECK( s3 == wxSize(2, 4) );
s3 /= 2;
CHECK( s3 == s1 );
CHECK( wxSize(6, 9) / 1.5 == wxSize(4, 6) );
}