Commit Graph

63 Commits

Author SHA1 Message Date
Vadim Zeitlin
e4f54cce1e Fix crashes in wxDateTime::ParseDate() for some invalid dates.
Parsing an incomplete date with nothing but whitespace and/or date delimiter
characters at the end crashed as we happily went beyond the end of string.

Fix this by not using a loop which didn't check for the iterator validity.

Closes #12685.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66166 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-16 22:37:52 +00:00
Václav Slavík
38914d5a51 Format strings fixes in test suite.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64711 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-06-24 10:34:23 +00:00
Francesco Montorsi
701aa4d804 revert previous revision about localization of decimal points in GetHumanReadableSize() test strings: using CLocaleSetter is a better solution.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64515 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-06-06 18:52:28 +00:00
Vadim Zeitlin
595c23b34e Compilation fix for VC6 after r63061.
VC6 doesn't support empty struct initializers apparently.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63062 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-01-04 12:22:34 +00:00
Vadim Zeitlin
8b7d411f14 Correctly parse times without seconds in wxDateTime::ParseTime().
This was always supposed to work but never did because of a typo in the "24
hour format without seconds" format specification. Fix this by removing the
extra "%S" from it and add a test for this case.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63061 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-01-04 11:05:47 +00:00
Vadim Zeitlin
404013f849 Correct wxDateTime::GetWeekOfMonth() for days in the beginning of January.
This function was implemented in terms of GetWeekOfYear() which made it tricky
to get it right as GetWeekOfYear() can, correctly, return week number for the
previous year for the first days of January (and also from the next one for
the last days of December).

Replace this implementation with a simple one directly counting the number of
weeks since the first of the month, this seems to be much simpler and does
pass the new unit test case which the old version failed.

Also make the unit test failures more informative by using
WX_ASSERT_EQUAL_MESSAGE() instead of CPPUNIT_ASSERT_EQUAL().

See #11561.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62916 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-12-17 17:51:12 +00:00
Vadim Zeitlin
9a83f86094 Globally replace _T() with wxT().
Standardize on using a single macro across all wxWidgets sources and solve the name clash with Sun CC standard headers (see #10660).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61508 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-23 20:30:22 +00:00
Vadim Zeitlin
52256b21b9 Added ParseFormat("%s") tests.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61495 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-22 16:41:52 +00:00
Vadim Zeitlin
15cb637c96 use CPPUNIT_ASSERT_EQUAL instead of CPPUNIT_ASSERT whenever possible to see more information about the test failures
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60233 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-04-18 12:19:38 +00:00
Vadim Zeitlin
84d8eabd81 no changes, just fixed typo in an error message
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60010 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-04-04 11:49:30 +00:00
Vadim Zeitlin
89a7e1ff98 Added wxLOCALE_DATE/TIME_FMT support to wxLocale::GetInfo().
- Implement for POSIX and Win32, TODO for OS X
- Use this instead of ad hoc code in wxDateTime::ParseFormat()
- Remove HAVE_STRPTIME, we don't need nor use strptime() any more


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59914 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-29 17:15:43 +00:00
Vadim Zeitlin
2e6c4a5702 give more detailed message when the test fails in TestTimeFormat()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59844 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-25 12:59:19 +00:00
Vadim Zeitlin
e538985edc added GetEnglish{Month,WeekDay}Name()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59811 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-24 16:51:10 +00:00
Vadim Zeitlin
dc310ea07f discard the time zone part of strings being parsed (generalizes the "CEST"-ignoring hack of r59682)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59809 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-24 12:19:21 +00:00
Vadim Zeitlin
66f22f4ae5 fix parsing methods for non-ASCII strings (e.g. dates in non-"C" locales) (see #9560)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59798 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-24 00:11:42 +00:00
Vadim Zeitlin
34d4d2864c enforce "C" locale for tests which can't work in any other (because test data is in English)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59797 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-23 23:29:10 +00:00
Vadim Zeitlin
3aa3163f66 give better error messages when tests fail
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59796 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-23 23:22:37 +00:00
Francesco Montorsi
1789c1c602 fix for PCH-less builds
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59694 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-21 12:34:18 +00:00
Francesco Montorsi
a6121fc4e0 fixes for Italian locale: ignore a final 'CET' string and don't test '%p' for it
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59682 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-21 00:37:19 +00:00
Vadim Zeitlin
6b522db5c8 correct wxDateTime DST begin/end computations for years > 2006 in USA (closes #10425)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58486 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-28 21:52:37 +00:00
Vadim Zeitlin
b2eabfe866 abstract VC6 workaround inside a WX_CPPUNIT_ALLOW_EQUALS_TO_INT() macro
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57833 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-04 16:04:22 +00:00
Vadim Zeitlin
c9e46deaa7 fix wxTimeSpan::Format() for negative spans with 0 hour component (#10055)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57474 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-12-21 12:16:06 +00:00
Vadim Zeitlin
93a800a95e minor icc warning fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56845 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-11-19 09:55:27 +00:00
Vadim Zeitlin
b5f85206a9 fix ParseFormat("%d") to set the date it finds (#10002)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55900 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-09-26 15:27:08 +00:00
Vadim Zeitlin
ece97e2882 remove the just added assertEquals(time_t, long) overload, it results in infinite recursion and crash if time_t is the same type as long
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54722 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-07-19 20:07:36 +00:00
Vadim Zeitlin
1de532f57e get rid of special WX_ASSERT_FOO_EQUAL macros by defining CppUnit::assertEquals() overloads for wx types
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54696 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-07-18 23:07:23 +00:00
Vadim Zeitlin
425eee4164 correct some compatibility problems with the existing Unicode-mode code (#9513), more remains to be done (#9560)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54060 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-06-09 22:50:55 +00:00
Vadim Zeitlin
a669640b7a really fix the test to work in any time zone and with or without DST
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53902 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-06-01 15:44:16 +00:00
Vadim Zeitlin
cf9f673789 fix wxDateTime::ParseRfc822Date() to handle missing seconds (ticket #1341)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53900 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-06-01 14:37:26 +00:00
Vadim Zeitlin
77fa3d8243 add a special macro for comparing time_t values to fix unit test compilation on platforms with 64 bit time_t (such as FreeBSD 6.2 apparently)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53894 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-06-01 13:01:59 +00:00
Vadim Zeitlin
c4e2528835 fix time zone conversion test to work in any time zone, not just GMT+1
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53893 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-06-01 12:58:43 +00:00
Vadim Zeitlin
c226adeedb use CPPUNIT_ASSERT_EQUAL instead of CPPUNIT_ASSERT to have more details when the test fails
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53885 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-05-31 23:08:57 +00:00
Vadim Zeitlin
f3f2e255b4 added wxDateTime::FormatISOCombined() and ParseISODate/Time/Combined()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51516 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-02-03 13:04:56 +00:00
Vadim Zeitlin
3781c92083 don't write wide string to std::ostream which outputs them as pointer values
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51255 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-16 22:15:18 +00:00
Vadim Zeitlin
5098c258b2 compilation fixes for VC6
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51188 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-13 01:13:03 +00:00
Vadim Zeitlin
71ebd60b06 make wxDateTime::ParseXXX() functions char*-friendly
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51059 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-07 00:17:45 +00:00
Vadim Zeitlin
b7c746d017 added WX_ASSERT_MESSAGE macro to simply using CPPUNIT_ASSERT_MESSAGE with wxString::Format()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51056 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-06 22:57:09 +00:00
Vadim Zeitlin
1cf57808cb fix bug with parsing negative time zones in ParseRfc822Date()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50955 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-12-30 23:35:40 +00:00
Vadim Zeitlin
804eeca5d5 don't misinterpret the time after the date as a weekday (patch 1836708)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50732 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-12-15 21:03:21 +00:00
Vadim Zeitlin
c6a95dd6a2 really fixed the DST test by using explicit country in it
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48998 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-09-30 19:28:29 +00:00
Vadim Zeitlin
770882a69e return the beginning/end of DST in local time, not UTC, for consistency with the other methods; fixed the test
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48997 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-09-30 19:27:23 +00:00
Václav Slavík
8650108199 don't use implicit wxString->char*/wchar_t* conversion, it will not be available in wxUSE_STL build in the future
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46391 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-06-10 17:42:41 +00:00
Vadim Zeitlin
fb96cf856e added wxDateTime::GetDateOnly()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44242 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-01-18 14:06:37 +00:00
Vadim Zeitlin
d581cac5e8 fix gcc compilation warning
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42584 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-10-28 17:04:52 +00:00
Vadim Zeitlin
c7564c6ac9 added more time span formatting tests
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40206 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-07-20 15:11:18 +00:00
Vadim Zeitlin
e566ccf1ba handle negative time spans correctly in Format()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40205 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-07-20 15:04:10 +00:00
Vadim Zeitlin
9807f99505 fixed TestTimeFormat() test: and can use 2 digit years which broke dates comparison for dates not in this (nor last) century
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40201 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-07-20 13:41:49 +00:00
Vadim Zeitlin
1bf29a7a6c added wxTimeSpan::Format() test
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40199 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-07-20 13:20:00 +00:00
Vadim Zeitlin
8605eb1abe added ParseDate() tests; use CPPUNIT_ASSERT_EQUAL to see the dates in cppunit output
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38256 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-03-21 16:21:18 +00:00
Vadim Zeitlin
34af0de434 compilation fixes for wxUSE_DATETIME==0 (another part of patch 1203970)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37493 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2006-02-11 16:20:28 +00:00