Commit Graph

1254 Commits

Author SHA1 Message Date
Vadim Zeitlin
0825f0ba2b Fix wxFindWindowAtPoint() with nested windows in wxMSW.
Return the deepest child of the window and not the first one as this function
needs to return the window that is at the top of Z-order.

Closes #14591.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72470 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-09-13 17:12:42 +00:00
Vadim Zeitlin
8421cb3c7c Fix bugs in parsing wxLongLong values starting with zeroes.
wxCRT_StrtoullBase(), used by wxString::To[U]LongLong(), didn't handle leading
zeroes nor leading 0x correctly: it never auto-detected base 8; didn't ignore
the leading 0 even if base 8 was specified explicitly; didn't recognize "0X"
prefix at all (only "0x").

Fix all these bugs and add test cases for parsing numbers in other bases to
the unit tests.

Closes #14596.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72408 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-08-30 20:22:17 +00:00
Václav Slavík
bb0907b743 Test if wxString::Format() works with non-ASCII format string.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72374 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-08-25 11:14:17 +00:00
Vadim Zeitlin
93b87dd910 Respect item max sizes in wxBoxSizer.
Don't give more space than the max size, if set, to wxBoxSizer elements.

Closes #11497.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72345 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-08-15 23:34:27 +00:00
Vadim Zeitlin
054fdb68eb Honour window min and max sizes in wxWindow::GetBestSize().
The best size of the window should be at least as large as its min size and
less than its max size. This allows to override the windows own best size
determination with an explicit SetMinSize() or SetMaxSize() call.

See #11497.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72343 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-08-15 23:34:18 +00:00
Vadim Zeitlin
532324df23 Don't generate events from wxSpinCtrl::SetRange() in wxMSW.
Other ports don't send wxEVT_COMMAND_SPINCTRL_UPDATED from SetRange() even if
the value changed because it was adjusted to fit into the new range and this
makes sense as this change is not due to a user action, so don't send this
event under wxMSW neither.

Also add a unit test checking for this behaviour.

Closes #14583.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72341 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-08-15 23:34:10 +00:00
Vadim Zeitlin
6d93e28adf Fix comparisons of char and wchar_t with wxUniChar[Ref].
Comparisons didn't work correctly in the other direction as they were not
reversed as needed. Fix this by adding wxDEFINE_COMPARISON_REV() macro which
defines comparisons in terms of the reverse operations and use it for both
wxUniChar and wxUniCharRef.

Closes #14547.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72268 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-31 16:49:36 +00:00
Vadim Zeitlin
a05cbc20e3 Fix bug in wxNumberFormatter::ToString() for negative numbers.
Don't include the possible leading sign in the span of digits to be grouped as
this gave nonsensical strings such as "-,123" when adding thousands separators
to "123".

Closes #14526.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72256 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-29 22:08:37 +00:00
Vadim Zeitlin
e9e077a843 Disable the recently added wxFileSystemWatcher unit case under Windows.
It currently fails there, so don't run it until this is fixed to let the tests
pass globally.

See #14480.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72080 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-14 20:10:54 +00:00
Julian Smart
04b2b47a4e Fixed wxRichTextCtrl caret test case
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72072 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-13 16:38:15 +00:00
Vadim Zeitlin
2b6d227c12 Test calling wxFileSystemWatcher::{Add,Remove}Tree().
Add a test for tree monitoring functions to the unit test.

See #14480.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72068 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-13 11:22:13 +00:00
Vadim Zeitlin
85668a34b3 Revert "Temporarily disable the failing wxRichTextCtrl case."
Revert r71945 which disabled failing wxRichTextCtrl unit test. It fails again
now and hopefully will be fixed before 2.9.5.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72031 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-11 12:16:41 +00:00
Paul Cornett
33a190beb6 fake paint events don't work with wxGTK3 either
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72021 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-11 07:32:10 +00:00
Vadim Zeitlin
14b682f7c3 Increase version to 2.9.5.
Rebake all the project/make files.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72007 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-10 23:51:44 +00:00
Vadim Zeitlin
fd78ef4715 Fix unit tests compilation in STL build.
Add missing c_str() calls forgotten by r70687.

Closes #14472.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72006 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-10 23:50:52 +00:00
Vadim Zeitlin
300fed484c Temporarily disable the failing wxRichTextCtrl case.
Disable CaretPosition() unit test as it is broken now. This is only temporary
to allow tests to pass in 2.9.4, will be reenabled (and hopefully fixed) later.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71945 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-02 15:08:09 +00:00
Vadim Zeitlin
d01ec0965c No changes, just suppress an unused variable warning.
Omit the name of the exception object that we never use.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71910 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-06-30 23:41:33 +00:00
Vadim Zeitlin
a523d3c643 Add a unit test verifying that wxSpinCtrl ctor doesn't generate any events.
This shouldn't happen but did (and apparently still does, sometimes) under MSW
so add a test verifying that no events are generated by the ctor.

See #14428.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71892 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-06-30 16:33:36 +00:00
Vadim Zeitlin
7e3ea54f47 Add missing c_str() and similar calls to samples in STL build.
Don't rely on implicit conversion of wxString to char*/wxChar*, it doesn't
exist in STL build. Add explicit c_str(), wc_str() or t_str() calls.

Closes #14420.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71820 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-06-20 17:54:42 +00:00
Vadim Zeitlin
784130d290 Disable wxUIActionSimulator wxGrid tests using mouse under wxGTK.
Something is seriously wrong with simulated mouse events and wxGrid under
wxGTK, they seem to simply disappear sometimes. This results in unit tests
suite failure, so disable these tests for the next release as I just don't
understand how to fix them.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71635 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-06-01 16:21:08 +00:00
Vadim Zeitlin
f1287154cd Add IsAutomaticTest() function to the unit tests.
This allows to easily test if we're running on a buildbot slave and disable
some difficult to debug test failures there.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71634 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-06-01 16:21:06 +00:00
Vadim Zeitlin
e84d989930 Use printf() instead of wxPrintf() in cppunit details listener.
Wide char output from wxPrintf() didn't appear at all under Linux because
stdout was switched into narrow stream mode by GNU libc due to initial use of
cout in the test.

Use printf() instead of wxPrintf() as we are only printing ASCII strings
anyhow. Of course, this is not a real fix but at least we can see the tests
results like this.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71633 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-06-01 16:21:03 +00:00
Vadim Zeitlin
fd5cfba711 Several fixes for wxAffineMatrix2D transformations.
Correct errors in TransformPoint() and TransformDistance().

Change Rotate() to interpret positive angles as rotating clockwise, for
consistency with wxGraphicsContext::Rotate().

Improve the unit test to verify that all the transformations work correctly.

Closes #14334.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71555 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-05-25 09:48:09 +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
6e36db5eca Correct the initial value setting in wxMSW wxSpinCtrl.
Always use value argument for the text control contents and also override the
initial numeric value with it if it's numeric.

This seems to be the only consistent thing to do, so document this behaviour
and add a unit test checking for it.

Closes #13589.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71387 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-05-09 14:24:20 +00:00
Vadim Zeitlin
39d169639b Fix wxString unit test when not using UTF-8.
Restrict the tests added in r70987 to run when using UTF-8 strings only, they
test for something that is simply not true (and for a bug that can't happen)
with non-multibyte encodings.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71384 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-05-09 14:24:10 +00:00
Vadim Zeitlin
c9f6f0a8cd Add wxDir::GetNameWithSep() and use it to avoid consecutive slashes.
It is wrong to use dir.GetName()+"/" to obtain a slash-terminated directory
name as this results in (usually harmless but at best ugly) double slashes at
at the beginning of the string for the root directory. Add GetNameWithSep() to
obtain the correct result in all cases.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71355 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-05-04 20:35:31 +00:00
Vadim Zeitlin
bb91ff63bc Don't remove the last slash from "/" directory name under Unix.
This was totally wrong as it returned empty string as (invalid) directory
name.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71353 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-05-04 18:31:48 +00:00
Vadim Zeitlin
f2f5d11c0e Use PCH in the tests in all Windows ports and not only when using wxMSW.
This change doesn't actually change anything for the "normal" ports as it only
affects wxGTK/MSW which is not officially supported yet, so the make/project
files are unchanged by it.

Closes #14249.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71325 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-04-29 23:22:28 +00:00
Vadim Zeitlin
7c7bd972fa Add a hack to prevent the test suite from aborting after Grid test case.
There is a problem with the native header control still having the mouse
capture when the grid is destroyed in wxGTK and this resulted in asserts when
destroying the grid, nested asserts due to an exception being thrown from a
dtor and finally abort that prevented the rest of the tests from running.

As I failed to find the real reason for this problem, just forcefully ensure
that we don't have the mouse capture when destroying the grid. This at least
allows the complete test suite to run.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71319 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-04-29 23:22:10 +00:00
Vadim Zeitlin
b57655127d Improve error reporting for nested asserts failures in the test suite.
If an assert occurred while handling an exception generated by a previous
assert handler, the information about the original assert was lost even if
though it was more important than the secondary assert. Do preserve and show
the original assert message in this case now.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71318 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-04-29 23:22:08 +00:00
Vadim Zeitlin
a610eb7369 Fix crash in wxFileConfig when deleting last entry of the root group.
This resulted in keeping a dangling pointer to the group line in
wxFileConfigGroup and any attempt to use it after this resulted in a crash.
Fix this by explicitly resetting the last line in this case.

Also add a unit test for this scenario.

Closes #14243.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71311 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-04-28 22:25:19 +00:00
Vadim Zeitlin
d9abe7f2f9 Run some wxTextCtrl unit test cases for single and multi-line controls.
Some of the tests that were previously ran for single or multi-line controls
only actually apply to both of them, so run them for both kinds of control to
test that both of them work correctly.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71307 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-04-28 22:25:01 +00:00
Vadim Zeitlin
358fb6ada6 No changes, just refactor wxTextCtrl unit test case.
Allow running the same tests for both single and multi-line controls easily.
No real changes yet though, the tests are still ran for the controls with the
same styles as before for now.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71306 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-04-28 22:24:59 +00:00
Vadim Zeitlin
4936c09982 Reuse wxMenu::SendEvent() from wxFrameBase::ProcessCommand().
Not only this avoids code duplication but it also fixes wrong code in
wxFrameBase version as it set the event object incorrectly to the frame itself
instead of setting it to the menu.

Added event object check to the menu events unit test.

Closes #1595.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71114 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-04-05 22:27:32 +00:00
Vadim Zeitlin
6eca840cc9 Add a very simple unit test checking for menu events.
Just verify that an event with the expected id was generated. The test will be
extended later to test for other event fields such as its source object,
see #1595.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71113 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-04-05 22:27:29 +00:00
Vadim Zeitlin
2415cf6725 Remove support for MetroWerks CodeWarrior compiler.
This compiler doesn't exist any more and was probably unsupported even in 2.8,
let alone 2.9, so remove all the __MWERKS__ tests to simplify things.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71102 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-04-05 18:40:11 +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
556a836e0f Don't cache incorrect length in wxString::assign(char*, size_t).
The length of the string here is specified in bytes and is not the same as the
string length for non-ASCII UTF-8 strings, so don't cache it as the string
length.

Just invalidate the cached length instead as we simply don't know what the
real length of the string is going to be.

See #14130.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70987 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-23 15:13:13 +00:00
Vadim Zeitlin
bd42a07c7a Fix caching wrong length in wxString(str, len) ctor in UTF-8 build.
A length greater than that of the source string could be passed to this ctor.
This worked correctly, i.e. created a string which was a copy of the source
one but cached a wrong length for it.

Avoid this by explicitly checking the length before caching it in
wxString::assign(str, len).

See #14130.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70986 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-23 15:13:08 +00:00
Steve Lamerton
1e0b0d7c55 Add new WX_ASSERT_EVENT_OCCURS macro to improve behaviour of testing asynchronous events. Use it in the wxWebView tests and re-enable previously failing tests.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70882 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-12 14:57:44 +00:00
Steve Lamerton
e7aa703d4b Delete buttons when we are finished so they do not overlap later controls and cause test failures.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70872 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-11 15:27:40 +00:00
Steve Lamerton
744d91d41f Move getting the unit test event count from wxTestableFrame to the EventCounter class. This reduces the need to have wxTestableFrame pointers all over the unit testing code and should reduce bugs caused by counting the wrong events.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70871 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-11 14:32:24 +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
bb5a951418 Use __WINDOWS__ for OS checks and __WXMSW__ for GUI checks (round 2).
This is continuation of r70796 and serves the same purpose.

Closes #14065, #14066.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70808 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-04 20:31:42 +00:00
Vadim Zeitlin
e18a74e240 Take disabled windows into account in wxFindWindowAtPoint() in wxMSW.
Use ChildWindowFromPointEx(CWP_SKIPINVISIBLE) to ensure that we find the
disabled children (by not using CWP_SKIPDISABLED).

Add a unit test to check for the correct behaviour in all cases and document
it.

Closes #2942.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70794 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-04 00:29:17 +00:00
Vadim Zeitlin
7cd60fb938 No changes, just cleanup TopLevelWindowTestCase unit test a little.
Remove the unnecessary overrides of setUp() and tearDown().

Also get rid of trailing whitespace.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70793 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-04 00:29:14 +00:00
Paul Cornett
f8497215c1 Fixes to allow running with 64-bit wxGTK
- use correct printf format specifiers
- don't perform operations requiring a window until the window has been created


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70764 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-01 07:09:43 +00:00
Vadim Zeitlin
2a408a4bf2 Add wxGCDC benchmarks to graphics benchmark for comparison with wxDC.
Also benchmark rectangles and bitmaps in addition to lines drawing.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70759 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-03-01 01:05:28 +00:00