+void DateTimeTestCase::TestDSTBug()
+{
+ /////////////////////////
+ // Test GetEndDST()
+ wxDateTime dt = wxDateTime::GetEndDST(2004);
+ CPPUNIT_ASSERT_EQUAL(31, (int)dt.GetDay());
+ CPPUNIT_ASSERT_EQUAL(wxDateTime::Oct, dt.GetMonth());
+ CPPUNIT_ASSERT_EQUAL(2004, (int)dt.GetYear());
+ CPPUNIT_ASSERT_EQUAL(2, (int)dt.GetHour());
+ CPPUNIT_ASSERT_EQUAL(0, (int)dt.GetMinute());
+ CPPUNIT_ASSERT_EQUAL(0, (int)dt.GetSecond());
+ CPPUNIT_ASSERT_EQUAL(0, (int)dt.GetMillisecond());
+
+ /////////////////////////
+ // Test ResetTime()
+ dt.SetHour(5);
+ CPPUNIT_ASSERT_EQUAL(5, (int)dt.GetHour());
+ dt.ResetTime();
+ CPPUNIT_ASSERT_EQUAL(31, (int)dt.GetDay());
+ CPPUNIT_ASSERT_EQUAL(wxDateTime::Oct, dt.GetMonth());
+ CPPUNIT_ASSERT_EQUAL(2004, (int)dt.GetYear());
+ CPPUNIT_ASSERT_EQUAL(0, (int)dt.GetHour());
+ CPPUNIT_ASSERT_EQUAL(0, (int)dt.GetMinute());
+ CPPUNIT_ASSERT_EQUAL(0, (int)dt.GetSecond());
+ CPPUNIT_ASSERT_EQUAL(0, (int)dt.GetMillisecond());
+
+ dt.Set(1, 0, 0, 0);
+ CPPUNIT_ASSERT_EQUAL(1, (int)dt.GetHour());
+
+ /////////////////////////
+ // Test Today()
+#ifdef CHANGE_SYSTEM_DATE
+ {
+ DateChanger change(2004, 10, 31, 5, 0, 0);
+ dt = wxDateTime::Today();
+ }
+
+ CPPUNIT_ASSERT_EQUAL(31, (int)dt.GetDay());
+ CPPUNIT_ASSERT_EQUAL(wxDateTime::Oct, dt.GetMonth());
+ CPPUNIT_ASSERT_EQUAL(2004, (int)dt.GetYear());
+ CPPUNIT_ASSERT_EQUAL(0, (int)dt.GetHour());
+ CPPUNIT_ASSERT_EQUAL(0, (int)dt.GetMinute());
+ CPPUNIT_ASSERT_EQUAL(0, (int)dt.GetSecond());
+ CPPUNIT_ASSERT_EQUAL(0, (int)dt.GetMillisecond());
+
+ /////////////////////////
+ // Test Set(hour, minute, second, milli)
+ wxDateTime dt2;
+ {
+ DateChanger change(2004, 10, 31, 5, 0, 0);
+ dt.Set(1, 30, 0, 0);
+ dt2.Set(5, 30, 0, 0);
+ }
+
+ CPPUNIT_ASSERT_EQUAL(31, (int)dt.GetDay());
+ CPPUNIT_ASSERT_EQUAL(wxDateTime::Oct, dt.GetMonth());
+ CPPUNIT_ASSERT_EQUAL(2004, (int)dt.GetYear());
+ CPPUNIT_ASSERT_EQUAL(1, (int)dt.GetHour());
+ CPPUNIT_ASSERT_EQUAL(30, (int)dt.GetMinute());
+ CPPUNIT_ASSERT_EQUAL(0, (int)dt.GetSecond());
+ CPPUNIT_ASSERT_EQUAL(0, (int)dt.GetMillisecond());
+
+ CPPUNIT_ASSERT_EQUAL(31, (int)dt2.GetDay());
+ CPPUNIT_ASSERT_EQUAL(wxDateTime::Oct, dt2.GetMonth());
+ CPPUNIT_ASSERT_EQUAL(2004, (int)dt2.GetYear());
+ CPPUNIT_ASSERT_EQUAL(5, (int)dt2.GetHour());
+ CPPUNIT_ASSERT_EQUAL(30, (int)dt2.GetMinute());
+ CPPUNIT_ASSERT_EQUAL(0, (int)dt2.GetSecond());
+ CPPUNIT_ASSERT_EQUAL(0, (int)dt2.GetMillisecond());
+#endif // CHANGE_SYSTEM_DATE
+}
+