Vadim Zeitlin
f4370376b6
Fix bugs in the recently added wxDateTime::DiffAsDateSpan().
...
Correct the test for negative spans less than a month and use the correct
month for computing the number of days in it.
Also add unit tests for problematic cases.
Closes #14704 .
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72616 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-04 22:48:30 +00:00
Vadim Zeitlin
77dd7daad2
Add wxDateTime::DiffAsDateSpan().
...
This method returns the difference between the dates as wxDateSpan, unlike the
existing Subtract() and overloaded operator-() that return wxTimeSpan.
Closes #14704 .
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72600 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-01 09:55:05 +00:00
Vadim Zeitlin
d44dc1bede
Fix wxDateTime unit test after the changes of r71430.
...
Don't test the return value of ParseFormat(wxCStrData) any more as this
function is void now.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71431 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-05-13 22:05:57 +00:00
Vadim Zeitlin
f17ac57417
Return valid pointers from wxDateTime::ParseXXX() with non-wxString strings.
...
The pointer returned by wxDateTime::ParseXXX() methods could point into a
buffer of a temporary wxString created to wrap a char* or wchar_t* argument so
dereferencing it was illegal.
Fix this by defining separate overloads for char*/wchar_t* arguments returning
pointers into the original string.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70996 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-25 16:45:53 +00:00
Vadim Zeitlin
1f29ecb357
Check for iterator validity when parsing "%%" in wxDateTime::Format() too.
...
This is similar to the previous commit and adds another missed check for the
iterator not being at the end of string.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70847 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-09 01:09:25 +00:00
Vadim Zeitlin
649148f93e
Check for end of string when parsing "%z" in wxDateTime::Format().
...
We could dereference an invalid iterator when parsing "%z", check for this in
the code and add a unit test for this case.
Closes #14075 .
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70846 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-09 01:09:20 +00:00
Vadim Zeitlin
86d19346c5
Fix wxDateTime unit test compilation without PCH.
...
Include wx/time.h to get wxGetTimeZone() declaration.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70269 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-01-05 10:21:46 +00:00
Vadim Zeitlin
444bc2b24d
Implement support for "%z" in wxDateTime::Format() and Parse().
...
"%z" specifier can now be used when printing the dates out to specify the time
zone and is also recognized when parsing dates.
Closes #1215 .
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70268 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-01-05 00:47:10 +00:00
Vadim Zeitlin
a5f226861c
Extract wxDateTime-related cppunit helpers in a separate header file.
...
No real changes, just refactor the code to allow using CPPUNIT_ASSERT_EQUAL
with wxDateTime in other tests in the future.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67989 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-06-19 22:46:42 +00:00
Dimitri Schoolwerth
e3778b4d9c
No code changes, fixed some typos.
...
Changed several occurrences of "it's" where "its" is meant, as well as a few other minor typos.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67656 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-04-30 10:57:04 +00:00
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