summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b561290)
This was accidentally removed in r51059, but worked in 2.8 and so should
continue to work.
Also add a unit test to ensure that this doesn't get broken again in the
future.
Closes #15204.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73988
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
"%H:%M:%S", // could be the same or 24 hour one so try it too
"%I:%M %p", // 12hour with AM/PM but without seconds
"%H:%M", // and a possibly 24 hour version without seconds
"%H:%M:%S", // could be the same or 24 hour one so try it too
"%I:%M %p", // 12hour with AM/PM but without seconds
"%H:%M", // and a possibly 24 hour version without seconds
+ "%I %p", // just hour with AM/AM
+ "%H", // just hour in 24 hour version
"%X", // possibly something from above or maybe something
// completely different -- try it last
"%X", // possibly something from above or maybe something
// completely different -- try it last
CPPUNIT_TEST( TestTimeWDays );
CPPUNIT_TEST( TestTimeDST );
CPPUNIT_TEST( TestTimeFormat );
CPPUNIT_TEST( TestTimeWDays );
CPPUNIT_TEST( TestTimeDST );
CPPUNIT_TEST( TestTimeFormat );
+ CPPUNIT_TEST( TestTimeParse );
CPPUNIT_TEST( TestTimeSpanFormat );
CPPUNIT_TEST( TestTimeTicks );
CPPUNIT_TEST( TestParceRFC822 );
CPPUNIT_TEST( TestTimeSpanFormat );
CPPUNIT_TEST( TestTimeTicks );
CPPUNIT_TEST( TestParceRFC822 );
void TestTimeWDays();
void TestTimeDST();
void TestTimeFormat();
void TestTimeWDays();
void TestTimeDST();
void TestTimeFormat();
void TestTimeSpanFormat();
void TestTimeTicks();
void TestParceRFC822();
void TestTimeSpanFormat();
void TestTimeTicks();
void TestParceRFC822();
dt.ParseFormat(s.c_str(), spec);
}
dt.ParseFormat(s.c_str(), spec);
}
+// Test parsing time in free format.
+void DateTimeTestCase::TestTimeParse()
+{
+ wxDateTime dt;
+
+ // Parsing standard formats should work.
+ CPPUNIT_ASSERT( dt.ParseTime("12:34:56") );
+ CPPUNIT_ASSERT_EQUAL( "12:34:56", dt.FormatISOTime() );
+
+ // Parsing just hours should work too.
+ dt.ResetTime();
+ CPPUNIT_ASSERT( dt.ParseTime("17") );
+ CPPUNIT_ASSERT_EQUAL( "17:00:00", dt.FormatISOTime() );
+
+ // Parsing gibberish shouldn't work.
+ CPPUNIT_ASSERT( !dt.ParseTime("bloordyblop") );
+}
+
void DateTimeTestCase::TestTimeSpanFormat()
{
static const struct TimeSpanFormatTestData
void DateTimeTestCase::TestTimeSpanFormat()
{
static const struct TimeSpanFormatTestData