X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a669640b7a3804215fe5208631ac572e723e084b..fbfe2d4e7caa118e1b609151bc72e7e5c7ac0f32:/tests/datetime/datetimetest.cpp diff --git a/tests/datetime/datetimetest.cpp b/tests/datetime/datetimetest.cpp index 2da45ba1d1..48611e4480 100644 --- a/tests/datetime/datetimetest.cpp +++ b/tests/datetime/datetimetest.cpp @@ -684,6 +684,31 @@ void DateTimeTestCase::TestTimeFormat() } } } + + // test compilation of some calls which should compile (and not result in + // ambiguity because of char*<->wxCStrData<->wxString conversions) + wxDateTime dt; + wxString s("foo"); + CPPUNIT_ASSERT( !dt.ParseFormat("foo") ); + CPPUNIT_ASSERT( !dt.ParseFormat(wxT("foo")) ); + CPPUNIT_ASSERT( !dt.ParseFormat(s) ); + CPPUNIT_ASSERT( !dt.ParseFormat(s.c_str()) ); + + CPPUNIT_ASSERT( !dt.ParseFormat("foo", "%c") ); + CPPUNIT_ASSERT( !dt.ParseFormat(wxT("foo"), "%c") ); + CPPUNIT_ASSERT( !dt.ParseFormat(s, "%c") ); + CPPUNIT_ASSERT( !dt.ParseFormat(s.c_str(), "%c") ); + + CPPUNIT_ASSERT( !dt.ParseFormat("foo", wxT("%c")) ); + CPPUNIT_ASSERT( !dt.ParseFormat(wxT("foo"), wxT("%c")) ); + CPPUNIT_ASSERT( !dt.ParseFormat(s, "%c") ); + CPPUNIT_ASSERT( !dt.ParseFormat(s.c_str(), wxT("%c")) ); + + wxString spec("%c"); + CPPUNIT_ASSERT( !dt.ParseFormat("foo", spec) ); + CPPUNIT_ASSERT( !dt.ParseFormat(wxT("foo"), spec) ); + CPPUNIT_ASSERT( !dt.ParseFormat(s, spec) ); + CPPUNIT_ASSERT( !dt.ParseFormat(s.c_str(), spec) ); } void DateTimeTestCase::TestTimeSpanFormat() @@ -736,14 +761,14 @@ void DateTimeTestCase::TestTimeTicks() // GetValue() returns internal UTC-based representation, we need to // convert it to local TZ before comparing - long ticks = (dt.GetValue() / 1000).ToLong() + TZ_LOCAL.GetOffset(); + time_t ticks = (dt.GetValue() / 1000).ToLong() + TZ_LOCAL.GetOffset(); if ( dt.IsDST() ) ticks += 3600; - WX_ASSERT_TIME_T_EQUAL( d.gmticks, ticks + tzOffset ); + CPPUNIT_ASSERT_EQUAL( d.gmticks, ticks + tzOffset ); dt = d.DT().FromTimezone(wxDateTime::UTC); ticks = (dt.GetValue() / 1000).ToLong(); - WX_ASSERT_TIME_T_EQUAL( d.gmticks, ticks ); + CPPUNIT_ASSERT_EQUAL( d.gmticks, ticks ); } }