Make wxTimeSpan::operator-() const

Due to an oversight, it wasn't declared as const, making it impossible to
subtract from a const wxTimeSpan object.

Fix this and add a unit test verifying that this compiles and works as
expected.

Closes #17583.
This commit is contained in:
Vadim Zeitlin
2016-06-30 16:49:20 +02:00
parent 9bf97bd607
commit ffcdcc1617
3 changed files with 16 additions and 1 deletions

View File

@@ -1346,6 +1346,10 @@ void DateTimeTestCase::TestTimeArithmetics()
// And a reverse. Now we should use days in Jun (again 30 => 4w 1d)
CPPUNIT_ASSERT_EQUAL( wxDateSpan(0, -10, -4, -1), dtd1.DiffAsDateSpan(dtd2) );
const wxTimeSpan ts1 = wxTimeSpan::Seconds(30);
const wxTimeSpan ts2 = wxTimeSpan::Seconds(5);
CPPUNIT_ASSERT_EQUAL( wxTimeSpan::Seconds(25), ts1 - ts2 );
}
void DateTimeTestCase::TestDSTBug()