Commit Graph

1230 Commits

Author SHA1 Message Date
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
Vadim Zeitlin
b02dd12239 Use /bin/echo for creation of Mac OS X PkgInfo files.
The built-in of /bin/sh doesn't handle "-n" option that we use (at least not
under OS X 10.6), so we were getting "-n APPL????" in the generated files.
Fix this by using /bin/echo which does support this option.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70744 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-02-28 22:48:39 +00:00
Vadim Zeitlin
7c9b6c9111 Compare file inodes if possible in wxFileName::SameAs().
This allows to correctly return when the two files with different names
actually refer to the same file system object.

Closes #910.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70687 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-02-25 23:49:35 +00:00
Vadim Zeitlin
41fec01fa9 Remove temporary files created by wxFileName unit test case.
Don't leave temporary files created by wxFileName::CreateTempFileName() lying
around.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70686 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-02-25 23:49:32 +00:00
Michael Wetherell
8bda419d02 Remove testing against zip in a pipeline as it no longer supports it.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70662 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-02-21 20:11:16 +00:00
Vadim Zeitlin
9362d82351 Fix unit test French locate checks for glibc >= 2.8.
Until 2.7 glibc wrongly used periods instead of slashes as separators for the
French date format and the test accounted for this, breaking it with recent
glibc versions in which this bug was fixed.

Fix this by limiting the workaround to the old glibc versions only.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70629 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-02-20 10:59:37 +00:00
Vadim Zeitlin
996d3fe3f8 Added wxFileName::Exists().
This function checks for existence of anything with the given name, not
necessarily just a file or a directory.

Extend the unit test to verify that it returns true for /dev/null on Unix
systems.

Closes #953.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70600 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-02-15 15:39:46 +00:00
Vadim Zeitlin
901504c383 Refactor wxFileName existence checking code.
Merge FileExists() and DirExists() together in a single
wxFileSystemObjectExists() helper in preparation for adding a function
checking for the existence of any kind of file system object.

There should be no changes for MSW/Unix but OS/2 file detection was changed
slightly to always use DosQueryPathInfo() instead of using it only for the
directories and stat() for files. Not sure if this is the right thing to do
there but it seems like the code should work.

Also add a simple unit test for these functions.

See #953.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70599 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-02-15 15:39:41 +00:00
Vadim Zeitlin
49a63afbad Avoid CRT deprecation warnings for MSVC build using makefiles too.
Define _CRT_SECURE_NO_DEPRECATE, _CRT_NON_CONFORMING_SWPRINTFS and
_SCL_SECURE_NO_WARNINGS when using makefiles to build the library too for
consistency with the project files.

These defines are only needed for VC8 and later but should do no harm for the
previous versions.

See #11009.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70532 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-02-07 21:38:31 +00:00
Vadim Zeitlin
ba7512e14d Rebake all project files to reflect MSVC deprecation warnings defines.
Rebake all the projects after the changes of r70182, even if they're only
really needed for the library itself, the other project files should
correspond to the bakefiles contents too.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70531 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-02-07 21:38:09 +00:00
Vadim Zeitlin
75717cb121 Fix handling of positional parameters in wxPrintf() and related.
Handle positional parameter specifications in wxFormatConverter to ensure that
e.g. "%N$s" are correctly transformed to "%N$S" if needed. This fixes the use
of positional parameters under OS X.

Closes #10965.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70523 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-02-06 13:28:34 +00:00
Vadim Zeitlin
cec8d6774a Add unit test verifying compilation of various wxFont ctors.
Check that various invocations of wxFont ctor at least compile to avoid
problems like the ones fixed by r70450.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70451 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-01-23 14:42:56 +00:00
Vadim Zeitlin
5c7fe47762 Fix wxAffineMatrix2D::Translate() to multiply on the left.
The affine transform was previously multiplied by the translation matrix on
the right but this was incompatible with both the MSW version of the same
method and all the other methods of the generic version.

So multiply the transform by the translation on the left, as everywhere else.

Closes #13875.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70444 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-01-23 11:28:16 +00:00
Vadim Zeitlin
f7f7b59ab2 Added a simple benchmark of wxLogDebug() and wxLogTrace().
Measure time taken by these calls when the debug/trace messages are not
enabled.

See #11829.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70434 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-01-22 00:58:09 +00:00
Vadim Zeitlin
71f44b1bc4 Update the message catalog charset expected by the unit test.
The charset of the message catalog files changed to UTF-8 in r70411 but the
unit test still expected ISO-8859-1. Update the unit test too to make it pass
again.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70419 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-01-20 23:18:29 +00:00
Vadim Zeitlin
f2c6e60762 Ensure wxCharTypeBuffer data is NUL-terminated after extend() call.
As wxCharTypeBuffer ctor taking the length NUL-terminates the buffer, it may
be expected that extend() does the same but it did not. Do add the NUL at the
end for consistency, even though it's not really needed for the existing code
using extend() in wxWidgets itself.

Closes #13885.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70417 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-01-20 22:11:51 +00:00
Dimitri Schoolwerth
2d143b6689 Removed ellipsis from "About..." occurrences.
MS and Apple guidelines mention ellipses should generally be used when a command needs additional information from the user before the operation can execute. This is not the case for showing an about dialog so the ellipses have been removed.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70412 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-01-20 16:51:09 +00:00
Dimitri Schoolwerth
ecc8721a0a Changed .po files to use UTF-8 charset.
Changing the localisation files to be in UTF-8 allows them to be committed by the pre-commit hook script.

Also regenerated relevant .mo files.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70411 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-01-20 16:33:41 +00:00
Vadim Zeitlin
e4a23857ec Implement wxMenuBar::EnableTop() for wxMSW and wxGTK.
This method was only available in wxUniv before and just always returned true
in the other ports. Implement it for wxMSW and wxGTK too now and document it.
Also add a unit test.

Closes #795.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70350 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-01-15 13:41:17 +00:00
Vadim Zeitlin
2db3b9a6a4 Fix unit test build with wxUSE_ZIPSTREAM or wxUSE_TARSTREAM == 0.
Disable the tests using wxZipEntry when it's unavailable. Also do the same for
wxTarEntry.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70349 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-01-15 12:28:57 +00:00
Vadim Zeitlin
be74a2a21a Fix the size of the font returned from wxTextCtrl::GetStyle() in wxMSW.
Due to a typo the size was expressed in 1/10th of a point and not in points.
Fix this and add a unit test checking that GetStyle() returns the same font as
was set by SetStyle().

Closes #2120.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70341 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-01-14 17:57:11 +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
e4aadc2f1d Update wxGrid unit tests after r70177.
The row/column selection is not stored in the block arrays, see #12638.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70194 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-12-29 23:39:27 +00:00
Steve Lamerton
d296f9a114 Disable final failing wxWebView test. It fails on the buildbot but not locally.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70149 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-12-28 10:01:05 +00:00