Commit Graph

891 Commits

Author SHA1 Message Date
Vadim Zeitlin
e3ab69523b Add wxString::ToStdString() and ToStdWstring().
These trivial helper functions are available in all builds (provided that
wxUSE_STD_STRING is not explicitly set to non-default 0 value) unlike implicit
conversions to std::[w]string which are only available when wxUSE_STL==1.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63938 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-11 11:08:49 +00:00
Vadim Zeitlin
43aecc4dd7 Add non-template wxWeakRef<T> constructor from T*.
We need a non-template ctor to make the code initializing wxWeakRef with
literal NULL to compile.

Closes #11916.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63934 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-10 18:13:29 +00:00
Václav Slavík
b796194b15 Regenerated makefiles after removing USE_GDIPLUS.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63925 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-09 14:14:26 +00:00
Robin Dunn
38723be1d5 Add wxVectorSort function for sorting wxVector<T> containers. Closes #11889
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63904 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-07 20:32:25 +00:00
Vadim Zeitlin
a07526187a Rename the rest of wxSIZE_CONV_TRADIONAL to wxSIZE_CONV_TRADITIONAL.
Fix tests compilation after r63886.

See #10673.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63891 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-07 10:50:41 +00:00
Vadim Zeitlin
58271f42ce Attempt to correct mysterious MSVC6 compilation error.
For some reasons MSVC6 refuses to compile TestData struct initialization. Try
to work around it by not using wxULongLong as this looks like the only thing
which might be confusing it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63874 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-06 17:38:27 +00:00
Vadim Zeitlin
be8332eb97 Fix more harmless warnings.
Fix a warning about unused parameters and another about signed/unsigned
comparison during samples and tests compilation.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63873 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-06 17:38:23 +00:00
Vadim Zeitlin
b2edb8f3c5 Add support for IEC and SI size units to wxFileName::GetHumanReadableSize().
Allow choosing the multiplier to use (1000 or 1024) and the names of the units
(SI or IEC). By default, still use traditional convention, i.e. multiplier of
1024 but SI unit names. This will probably need to be changed to use IEC units
in the future.

Also added unit test for this function.

Closes #10673.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63870 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-06 14:53:04 +00:00
Francesco Montorsi
00e075e551 Committing modified version of jwiesemann's patch (see #11223):
Fix wxURL copy ctor and assignment: the default ones provided by the compiler are wrong because wxURL uses pointers internally. 
Also add a test for copy & assignment in URLTestCase.

Closes #11223

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63806 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-30 21:38:31 +00:00
Vadim Zeitlin
bd9532a416 Add wxBitmap unit test.
This should have been part of r63774.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63778 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-29 09:59:05 +00:00
Vadim Zeitlin
27297c823a Implement wxMask copy ctor for wxGTK.
Without copy ctor copying masks simply crashed because the same pointer was
deleted twice.

Also added a (completely trivial but better than nothing...) unit test for
wxBitmap to check that copying masks does work now.

Closes #11854.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63774 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-28 23:20:49 +00:00
Václav Slavík
b37dacdca6 Fix UTF-8 string storage in constant: use unsigned char.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63765 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-28 17:52:19 +00:00
Václav Slavík
abd5e008f1 Add test wxFileSystem::FileNameToURL,URLToFileName roundtrip with
Unicode filenames.

See #11491.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63762 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-28 15:41:29 +00:00
Vadim Zeitlin
b66a68884d Temporarily disable wxFileSystemWatcher unit test under OS X.
This tests hangs and never finishes, disable it for now to allow buildbot to
at least run the other tests.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63739 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-22 16:08:44 +00:00
Francesco Montorsi
32ee98eb76 reorder GetLabel(), GetLabelText(), SetLabel() and SetLabelText() function declarations, implementations and relative documentations.
Add wxStaticTextBase::GetLabelWithoutMarkup() and use it in the wxMSW implementation of wxStaticText::SetLabel() to close bug #11446; the function RemoveMarkup() which was previously used in fact could not check for presence/absence of wxST_MARKUP style since it's a static function.

Add wxStaticTextBase::SetLabelText() functions for symmetry with wxControlBase::SetLabelText()

Add test unit for both wxControl::*Label* and wxStaticText::*Label* functions.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63733 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-21 21:39:15 +00:00
Vadim Zeitlin
0772a89875 Ensure that setting wxChoice height to its default value does set it.
Setting wxChoice height to its default value didn't change the height even if
the current height was different from the default. This resulted in problems
when a wxChoice was used inside a wxAuiToolBar because AUI temporarily reduces
the toolbar size to (1, 1) when docking it (thus ensuring that the height of
wxChoice is changed too) and generally didn't make sense.

Fix this by resetting the height to the default value if the value passed to
wxChoice::SetSize() is what it considers to be its default height.

Add a unit test for this bug and also add a wxChoice to AUI sample to allow
testing for wxChoice behaviour inside a wxAuiToolBar being [un]docked.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63708 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-18 15:07:39 +00:00
Vadim Zeitlin
729f53d421 Fix box sizer layout algorithm to respect both proportions and min sizes.
The new version of the algorithm tries to distribute the entire space
allocated to the sizer among its children, just as the version in 2.8 did,
while still respecting minimal children sizes first and foremost. This means
that the space allocated to the item will always be at least its minimal size
if the total space is at least equal to the sum of minimal sizes of the
children but that if there is enough space, the proportions will be respected
too.

Extended the unit test to check that laying out various combinations of three
elements results in the expected results.

Closes #11311.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63706 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-18 15:07:24 +00:00
Vadim Zeitlin
a71aeb2426 Ensure that size in the minor direction of box sizer doesn't exceed the total.
This is similar to the previous commit but for the transversal direction of a
box sizer: we could give an item size larger than the size of the sizer itself
making only part of its window visible (and thus potentially making the window
unusable e.g. because the scrollbar wasn't visible at all).

Fix this by always restricting the item size in the minor direction to the
total size available and add a unit test which failed previously and passes
now.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63705 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-18 15:07:19 +00:00
Vadim Zeitlin
26022721e8 Ensure that size in the major direction of box sizer doesn't exceed the total.
After fixing the problem with "growing items by negative proportion" in r56010
(which still was the correct thing to do as it fixed such indefensibly broken
behaviour as shrinking items with larger proportion by more than "smaller"
items when there was not enough space) the items in a box sizer could become
larger than the total space allocated to the sizer resulting in only parts of
them being visible.

Fix this by truncating the items to the (remaining) total size even if this
means making them less than their minimal sizes -- because there is nothing
else we can do when the total space is smaller than the sum of minimal sizes
anyhow.

Closes #10008.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63704 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-18 15:07:14 +00:00
Vadim Zeitlin
869c7a944b Add (a very simple for now) wxBoxSizer unit test.
Only check that layout for a single sizer item works correctly for now.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63703 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-18 15:07:10 +00:00
Vadim Zeitlin
968d3a2461 Fix test for compilers not supporting \u escapes in strings (such as VC6).
Also reformat the code to follow wx style and explicitly use UTF-8 for the
test strings encoding instead of assuming the encoding of the current locale
was UTF-8 (which is never the case under Windows).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63685 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-14 14:47:11 +00:00
Vadim Zeitlin
a41b1a1bba Set correct properties for the new file added in r63660.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63684 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-14 14:44:25 +00:00
Francesco Montorsi
a37da0fa55 Fix function wxControlBase::DoEllipsizeSingleLine to really make sure that the ellipsized string takes less pixels than maxFinalWidthPx.
Add comments to explain in more details what the function does and in particular the valid ranges of all internal variables; fix in that regard both the code of both wxELLIPSIZE_START, wxELLIPSIZE_MIDDLE and wxELLIPSIZE_END.
Add more asserts to check the valid ranges and turn a couple of time-expensive checks in level-2 asserts.
Add a test unit for the wxControl::Ellipsize function.
Fix minor details in the docs of wxControl::Ellipsize.
Closes #11567.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-10 13:57:47 +00:00
Vadim Zeitlin
0c550516dd Fix bug in wxStringOutputStream unit test.
We wrote an extra NUL byte to the stream and, unsurprisingly, contents of its
buffer didn't match the original string resulting in the test failure.

Also get rid of a #if wxUSE_UNICODE.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63249 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-01-24 11:33:24 +00:00
Vadim Zeitlin
975fb32b5c Don't crash when input is empty in wxFileConfig(wxInputStream) ctor.
Fix crash due to dereferencing a NULL pointer when the input buffer in
wxFileConfig ctor is empty.

Closes #11636.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63228 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-01-23 13:22:14 +00:00
Vadim Zeitlin
cbab155657 No real changes, just fix a typo in comments and documentation.
Use "surprising" instead of (common) "surprizing" misspelling.

Closes #11627.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63154 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-01-14 18:02:26 +00:00
Vadim Zeitlin
4cb0e8d05c Fix wxConvAuto behaviour when it is used by wxTextInputStream.
wxConvAuto implicitly supposed that the chunk of data passed to it for
translation was big enough to allow it to at least detect the BOM from it.
However this isn't necessarily the case and never is with wxTextInputStream
which reads the bytes one by one.

Fix this by waiting until we have enough data to be able to detect the BOM.
This still doesn't fix the problem with streams without BOM and the
corresponding unit test still fails -- it will need to be fixed at the level
of wxTextInputStream itself later but handling correctly the cases when a BOM
is present is already better than before.

See #11570.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63064 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-01-04 12:22:49 +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
Kevin Ollivier
da8b1d4b3b Rebake from clean wx tree.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63052 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-01-04 00:45:45 +00:00
Michael Wetherell
9e477451a1 Add another test for sparse file support so that the large file tests can run
as part of the default suite for more platforms.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63024 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-12-30 17:44:09 +00:00
Michael Wetherell
c896c76129 Repair the stream tests.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63022 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-12-30 17:39:47 +00:00
Michael Wetherell
224d978ffb Add support for large stdio files for VC 8+. What versions of the other Windows
compilers?


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62974 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-12-22 21:22:59 +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
94b6ce7f4b Use X64 machine type for MSVC linker instead of old AMD64.
The officially supported machine type name is X64 now, even if AMD64 is still
supported.

Closes #10711.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62825 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-12-08 16:36:37 +00:00
Vadim Zeitlin
2730723380 Correct two bugs in wxMBConv::FromWChar() with non NUL-terminated strings.
The variable "lenChunk" was incorrectly used as the length of the wide string
chunk which could result in wrong output.

Worse, the output buffer could be overflown for the final chunk because it
didn't have to have enough space for the trailing NUL(s) in it.

Fix both bugs and added unit tests for them.

Based on patch by Kuang-che Wu.

Closes #11486.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62793 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-12-06 02:30:05 +00:00
Vadim Zeitlin
e01a788ee0 Add support for MSW unique volume names to wxFileName.
Recognize the paths starting with "\\?\Volume{GUID}" under MSW and provide a
way to test for them.

Closes #8874.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62782 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-12-05 17:31:00 +00:00
Vadim Zeitlin
874dbd3a4a Allow calling wxStrchr() with a narrow string and wide character.
Calls to wxStrchr(char-string, wide-char) would previously fail if wide
character couldn't be converted to a single character in the current locale
encoding. Change it to simply return NULL in this case as it's a safe and
useful generalization: a narrow string will never contain a wide character not
representable in the current locale.

Add wxUniChar::GetAsChar() to help with implementing this.

Closes #11487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62738 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-28 14:37:03 +00:00
Vadim Zeitlin
009f89f75d Make the assert in SettingsTestCase::GlobalFonts() more informative.
Show the index of the font and the face name which was invalid.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62707 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-24 00:01:51 +00:00
Jaakko Salli
7db064f60f Added typeinfo.h which implements wxTypeId, using C++ RTTI if available. wxAny and Unbind<>() code are updated to use it. Added and updated related unit tests.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62690 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-19 19:27:24 +00:00
Kevin Ollivier
f82b7036e8 Rebake after last commit.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62682 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-18 19:22:58 +00:00
Vadim Zeitlin
acaa833787 Fix unit test added in r62561 to work under Windows too.
The unit test checking that slashes were allowed in UNCs too didn't work under
Windows because GetPath() returned volume as part of the path there (and also
used backslashes by default), fix it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62579 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-09 18:20:05 +00:00
Vadim Zeitlin
7b611a3ae9 Recognize UNCs starting with forward slashes too in wxFileName.
Treat \\share\path and //share/path in the same way (for wxPATH_DOS paths).

Add a test for UNC parsing to the unit test.

Closes #11376.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62561 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-05 14:59:39 +00:00
Kevin Ollivier
a7ebaf0ddd Bakefile 0.2.8 rebake.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62522 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-31 20:56:47 +00:00
Kevin Ollivier
dbc7ceb925 Initial ShowWithoutActivating implementations for Mac and Windows, and attempt to improve IsActive behavior on Mac. Also adding ShowWithoutActivating() and Show/Hide tests, but until the mainloop issues are resolved, not adding them to tests.bkl.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62508 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-30 05:04:47 +00:00
Vadim Zeitlin
8c9833d09e Rebaked using post-0.2.7 svn version of bakefile.
Unfortunately 0.2.7 release contained a bug in msvc backend which resulted in
warnings generated for each file compiled. Apply the fix from bakefile svn to
fix this (and test if no other problems are found).

Also update all makefile.unx after changes of r62477.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62488 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-23 17:48:21 +00:00
Vadim Zeitlin
77241feb3f Use an even more informative error message in wxFSW unit test.
Dump information about both events when we received two of them instead of the
(single) expected one.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62486 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-23 11:44:57 +00:00
Vadim Zeitlin
1c9c8e88c2 Give more informative error in wxFSW test.
Output more details when more than one event is unexpectedly received.
Hopefully this will allow to debug the test failure at build bot slaves which
doesn't seem to be happening locally.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62482 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-22 23:54:55 +00:00
Vadim Zeitlin
d5236dfffd Fix g++ compilation of wxFileSystemWatcher test after VC6 fix.
Enums can't be used to deduce template parameters so cast WAIT_DURATION to int
explicitly before passing it to wxString::Format().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62481 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-22 23:54:47 +00:00
Vadim Zeitlin
771ce939f3 Fix wxFSW test compilation with VC6.
Work around an internal compiler error and don't initialize static variable
when declaring it as VC6 doesn't support this.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62480 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-22 16:57:41 +00:00