Commit Graph

179 Commits

Author SHA1 Message Date
Vadim Zeitlin
bbb0ff36db Fix another off-by-1 bug in wxMBConv::ToWChar().
When converting a fixed number of characters we need to take any NULs inside
the buffer being converted into account for our return value -- but this
wasn't done and converting 2 characters 'x' and '\0' returned only 1, even if
the length 2 was explicitly specified.

Fix this bug and add a unit test checking for it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62141 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-26 13:31:27 +00:00
Vadim Zeitlin
4bc9acbe16 No changes, just convert file to UTF-8.
All files in svn are supposed to use UTF-8 now so convert this one to UTF-8
too before committing more changes to it (which would be otherwise rejected by
pre-commit hook).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62140 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-26 13:31:20 +00:00
Vadim Zeitlin
69d31e3130 Output the extracted number from wxString::ToXXX() even if it returns false.
After the changes in r50710 wxString numeric conversion functions didn't
update their output parameter any more if the conversion failed because not
entire string was converted. This was incompatible with the old behaviour
which some existing code did rely on, so restore it and now always return the
number which was extracted from the beginning of the string if we found
anything at all, even if the function returns false.

Add unit test for the correct behaviour and updated the documentation.

Closes #11126.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61786 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-08-30 17:25:19 +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
787de19a13 update CRT environment block in wxSetEnv() too
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60728 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-05-24 15:33:33 +00:00
Vadim Zeitlin
75ac34cefc fix support for using asterisks in the format string and some code cleanup
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60120 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-04-12 23:37:28 +00:00
Vadim Zeitlin
390b8241d3 revert r60023 and really fixed compilation problems caused by r60017 by providing assertEquals(const char *, const char *) overload as well
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60024 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-04-04 23:55:05 +00:00
Vadim Zeitlin
0eb83a1a72 compilation fix after r60017
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60023 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-04-04 22:33:20 +00:00
Vadim Zeitlin
245ff47f7c fix the test for !wxUSE_UNICODE_UTF8 builds: don't suppose that strings are UTF-8 encoded in VsnprintfTestCase::S() but use FromUTF8() explicitly (how did it manage to work with VC9 before?)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60018 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-04-04 16:45:23 +00:00
Vadim Zeitlin
3879212eee fix VsnprintfTestCase::P() for mingw32 which may use MSVC CRT (closes #10679)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60016 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-04-04 16:02:23 +00:00
Vadim Zeitlin
727e8d842f fix the test case which wrongly relied on wxString using UTF-8 representation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60004 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-04-03 17:03:16 +00:00
Vadim Zeitlin
27dd021da3 fix the test case which wrongly relied on wxString using UTF-8 representation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60003 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-04-03 17:02:12 +00:00
Václav Slavík
de4983f323 split wxCharTypeBuffer<T> into wxScopedCharTypeBuffer<T> and wxCharTypeBuffer<T> -- the former is for transient data with validity limited to parent's lifetime, the latter is for permanent storage of string data (bug #9638)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59887 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-27 15:33:55 +00:00
Francesco Montorsi
16f7158098 put wxSetLocale() call in setUp() as VC6 still fails because of wrong locale in VsnprintfTestCase
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59785 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-23 16:25:44 +00:00
Francesco Montorsi
ca5016d4dd make sure that wxProcess always have a valid PID set; add test unit for wxExecute,wxShell,wxProcess based on the code in the console sample; add some more infos/notes in wxProcess docs
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59784 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-23 16:23:44 +00:00
Francesco Montorsi
12e91a550c fix typo; use C locale for VsnprintfTestCase
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59765 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-23 12:17:39 +00:00
Francesco Montorsi
529e491ce0 add the ToCLong, ToCULong and ToCDouble functions, with docs and test units
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59645 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-20 14:50:06 +00:00
Francesco Montorsi
fdfc5e18e7 comment-out tests provoking a low-level assert from debug CRT libs in MSVC 2008 (2005 probably affected too)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59635 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-20 01:03:38 +00:00
Václav Slavík
862bb5c73a renamed ATTRIBUTE_PRINTF to WX_ATTRIBUTE_PRINTF to avoid naming conflicts (e.g. with latest libxml2)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59479 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-11 07:51:38 +00:00
Vadim Zeitlin
072682ce44 optimize Replace() to use a linear algorithm (closes #9135)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59420 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-07 16:07:58 +00:00
Francesco Montorsi
35d3edcd53 make the testcase more readable; add a few checks to Asterisk() test; make unicode part of S() test compile with MSVC
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58989 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-18 14:57:42 +00:00
Francesco Montorsi
103339b01e fixed test failures under wxMSW when using our wxVsnprintf implementation (remains 1 bug introduced by the wx29 string changes)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58962 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-02-17 11:11:50 +00:00
Vadim Zeitlin
166523d8d7 calling wcsnlen(NULL) does crash (under Debian and, according to the docs, should also crash with MSVC), contrary to what the comment claimed so don't do this
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58152 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-16 17:48:59 +00:00
Francesco Montorsi
7c5ac499c8 provide our own implementation of wxStrnlen if it's not available; add tests for it
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58069 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-13 12:01:30 +00:00
Vadim Zeitlin
39e12b2d52 don't use \u in strings, VC6 doesn't support this
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57832 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-01-04 15:53:09 +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
527587d347 really fix VC6 compilation of all testsi (without breaking VC9)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56656 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-11-03 00:31:16 +00:00
Vadim Zeitlin
94bc35dc33 explicitly cast wxUniCharRef to char inside CPPUNIT_ASSERT_EQUAL
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56640 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-11-02 01:59:34 +00:00
Vadim Zeitlin
c565abe1c5 fix After{First,Last}() to work for strings with non-ASCII characters in UTF-8 build and added unit tests for this
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55944 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-09-29 12:08:44 +00:00
Václav Slavík
6bd4f2812d fixed writing to wxUniCharRef after its 'parent' iterator was destroyed
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55285 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-08-26 13:02:38 +00:00
Vadim Zeitlin
817d057840 added test for Replace(whatever, "")
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55032 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-08-09 15:50:24 +00:00
Vadim Zeitlin
0c7db140c5 add wxString::Capitalize() and MakeCapitalized() for consistency with Upper/Lower() we already have
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54915 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-08-01 23:39:11 +00:00
Václav Slavík
2f539d953b added a test for passing wxCharBufer to wxprintf functions
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54811 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-07-29 13:32:35 +00:00
Vadim Zeitlin
e3276230de fix bug with wxCSConv("ASCII")
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54703 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-07-19 01:45:38 +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
42e8b52f09 make test failures easier to debug by using more informative failure messages
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54672 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-07-17 23:24:21 +00:00
Vadim Zeitlin
ae43193571 don't run the tests which can't succeed in ANSI build; remove the tests for wxUSE_WCHAR_T, it's always 1 now; test MB2WC conversions in Unicode build too (it only tested WC2MB for some reason)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54671 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-07-17 23:01:17 +00:00
Vadim Zeitlin
339e08c704 use CPPUNIT_ASSERT_EQUAL(x,y) instead of CPPUNIT_ASSERT(x==y) to better see test failures
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54643 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-07-15 18:00:49 +00:00
Vadim Zeitlin
fa0584f14d use CPPUNIT_ASSERT_EQUAL(x,y) instead of CPPUNIT_ASSERT(x==y) to better see test failures
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54642 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-07-15 17:38:03 +00:00
Vadim Zeitlin
062dc5fc22 initialize wxStringBuffer with the original contents of wxString it was created from for better compatibility with the old, non-STL, build (this avoids problems such as ticket #4845); add wxString::tchar_buf() to help with the implementation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53995 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-06-06 21:19:23 +00:00
Vadim Zeitlin
44c6d979a8 removed the test which never works: Lower/Upper() don't work with Unicode strings currently
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53992 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-06-06 20:55:39 +00:00
Vadim Zeitlin
7ace5fd8e0 include wx/crt.h to get wxUSE_WXVSNPRINTF
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53904 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-06-01 16:58:17 +00:00
Vadim Zeitlin
05b5a45f96 don't run vsnprintf() test if we're using the system version, there is nothing we can do about its failures then anyhow
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53857 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-05-30 22:11:51 +00:00
Vadim Zeitlin
fc215b4140 don't compile the test in the build configurations where it's not supported (trying to fix buildbot OS X build)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53856 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-05-30 21:59:24 +00:00
Michael Wetherell
6ed28b941c Compile fixes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51944 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-02-20 22:28:02 +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
f312f981b5 added tests for FromAscii/Unicode() (length parameter); cleaned up ctors test
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51184 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-12 20:58:03 +00:00
Michael Wetherell
31c0639151 Missing header.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50985 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2008-01-02 08:04:30 +00:00
Vadim Zeitlin
99d8bc6593 added a trivial test for wxString stream insertion operators
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49102 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-10-09 00:10:07 +00:00
Vadim Zeitlin
2452025c59 fix a couple of harmless warnings in MSVC build
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48697 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2007-09-14 23:33:46 +00:00