]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/datetime/datetimetest.cpp
updated SetFont() documentation: it returns bool, not void (bug 1705330)
[wxWidgets.git] / tests / datetime / datetimetest.cpp
index feddc48085d2d95cb4a10d3b0498eeecd33bcba7..db64b5c53ecb8dbf900b40a7405d776bd0837aeb 100644 (file)
@@ -191,6 +191,7 @@ private:
         CPPUNIT_TEST( TestDateParse );
         CPPUNIT_TEST( TestTimeArithmetics );
         CPPUNIT_TEST( TestDSTBug );
+        CPPUNIT_TEST( TestDateOnly );
     CPPUNIT_TEST_SUITE_END();
 
     void TestLeapYears();
@@ -206,6 +207,7 @@ private:
     void TestDateParse();
     void TestTimeArithmetics();
     void TestDSTBug();
+    void TestDateOnly();
 
     DECLARE_NO_COPY_CLASS(DateTimeTestCase)
 };
@@ -920,4 +922,20 @@ void DateTimeTestCase::TestDSTBug()
 #endif // CHANGE_SYSTEM_DATE
 }
 
+void DateTimeTestCase::TestDateOnly()
+{
+    wxDateTime dt(19, wxDateTime::Jan, 2007, 15, 01, 00);
+
+    static const wxDateTime::wxDateTime_t DATE_ZERO = 0;
+    CPPUNIT_ASSERT_EQUAL( DATE_ZERO, dt.GetDateOnly().GetHour() );
+    CPPUNIT_ASSERT_EQUAL( DATE_ZERO, dt.GetDateOnly().GetMinute() );
+    CPPUNIT_ASSERT_EQUAL( DATE_ZERO, dt.GetDateOnly().GetSecond() );
+    CPPUNIT_ASSERT_EQUAL( DATE_ZERO, dt.GetDateOnly().GetMillisecond() );
+
+    dt.ResetTime();
+    CPPUNIT_ASSERT_EQUAL( wxDateTime(19, wxDateTime::Jan, 2007), dt );
+
+    CPPUNIT_ASSERT_EQUAL( wxDateTime::Today(), wxDateTime::Now().GetDateOnly() );
+}
+
 #endif // wxUSE_DATETIME