Commit Graph

60 Commits

Author SHA1 Message Date
Maarten Bent
054cb35b39 Workaround for a crash with gcc 9.1 from MSYS2 MinGW 32bit 2019-08-03 21:08:10 +02:00
Maarten Bent
3bab07edcf Fix some build warnings
private field 'm_dwCookie' is not used
'return' will never be executed
result of comparison of unsigned enum expression < 0 is always false
'FlushDC' overrides a member function but is not marked 'override'
potentially uninitialized local variable 'bound' used
2018-11-25 21:29:38 +01:00
Vadim Zeitlin
ef92b92691 Add unit test for wxCTZ
Check that the new function works reasonably correctly.
2018-11-05 19:27:53 +01:00
Maarten Bent
7c1ab06ea5 Add more wxOVERRIDE 2018-09-22 14:44:07 +02:00
Maarten Bent
a914478f60 Add guards around test cases 2018-09-19 22:01:17 +02:00
Maarten Bent
57180d68c8 Add wxOVERRIDE to test files
And cleanup some tailing spaces and tabs.
2018-07-29 12:08:53 +02:00
Vadim Zeitlin
62f9438ad3 Rewrite wxPathList unit test without CppUnit-compatible API
Simplify the test by using a single function instead of all the
machinery inherited from CppUnit.

Also provide more information in case of test failure.
2017-11-25 16:08:01 +01:00
Vadim Zeitlin
e70fc11ef1 Replace CppUnit with Catch for unit tests
Drop the legacy CppUnit testing framework used for the unit tests.
Replacing it with Catch has the advantage of not requiring CppUnit
libraries to be installed on the system in order to be able to run
tests (Catch is header-only and a copy of it is now included in the
main repository itself) and, in the future, of being able to write
the tests in a much more natural way.

For now, however, avoid changing the existing tests code as much as
[reasonably] possible to avoid introducing bugs in them and provide
the CppUnit compatibility macros in the new wx/catch_cppunit.h header
which allow to preserve the 99% of the existing code unchanged. Some
of the required changes are:

 - Decompose asserts using "a && b" conditions into multiple asserts
   checking "a" and "b" independently. This would have been better
   even with CppUnit (to know which part of condition exactly failed)
   and is required with Catch.

 - Use extra parentheses around such conditions when they can't be
   easily decomposed in the arrays test, due to the use of macros.
   This is not ideal from the point of view of messages given when
   the tests fail but will do for now.

 - Rewrite asserts using "a || b" as a combination of condition
   checks and assert macros. Again, this is better anyhow, and is
   required with Catch. Incidentally, this allowed to fix a bug in
   the "exec" unit test which didn't leave enough time for the new
   process to be launched before trying to kill it.

 - Remove multiple CPPUNIT_TEST_SUITE_NAMED_REGISTRATION() macros,
   our emulation of this macro can be used only once.

 - Provide string conversions using Catch-specific StringMaker for
   a couple of types.

 - Replace custom wxImage comparison with a Catch-specific matcher
   class.

 - Remove most of test running logic from test.cpp, in particular don't
   parse command line ourselves any longer but use Catch built-in
   command line parser. This is a source of a minor regression:
   previously, both "Foo" and "FooTestCase" could be used as the name of
   the test to run, but now only the latter is accepted.
2017-11-02 01:53:16 +01:00
Paul Cornett
7816ca6538 Fix building tests with wxUSE_XRC==0 2017-10-01 09:46:03 -07:00
Vadim Zeitlin
893102b926 Fix mismatched new[]/delete in a test case.
Use wxDELETEA() as the comment said we did -- except that we didn't.
2015-06-19 16:32:14 +02:00
Dimitri Schoolwerth
8f8d58d193 Use wx-prefixed macros throughout the repository.
Change {DECLARE,IMPLEMENT}_*CLASS and {DECLARE,BEGIN,END}_EVENT_TABLE
occurrences to use the wx-prefixed version of the macros.
2015-04-23 22:00:35 +04:00
Vadim Zeitlin
b7778beeef Give more details in GarbageTestCase unit test.
Try to find out why this test fails in the OS X buildbot builds.

Use macros to ensure that all checks provide information about the bitmap (or
animation) type they fail for, without having to repeat the same code for
doing it many times.
2015-04-12 22:30:52 +02:00
Dimitri Schoolwerth
66cfa40643 Deal with remaining cvs/svn keywords.
A few $Id$ references remained after commit
3f66f6a5b3 or appeared in newly added files.
Remove the lines containing svn keywords except when it concerns
third-party files. In that case keep the line as-is or collapse it to the
keyword if it had been expanded to contain wx commit information (only
occurs with src/zlib/ChangeLog).
2015-04-09 03:32:23 +04:00
Vadim Zeitlin
adf8f9d0cd Handle multiple item insertion and deletion in wxSelectionStore.
Rename the existing but not implemented and never used OnItemAdd() method to
OnItemsInserted() and add OnItemsDeleted(), which is more efficient than
OnItemDelete() when many items are being removed from the control at once.

This is not used yet, but will be used in wxDataViewCtrl soon and maybe in the
other controls later.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77904 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-27 20:46:21 +00:00
Vadim Zeitlin
06ab4da3f3 Add wxSelectionStore::IsEmpty() helper.
Just a simple and potentially (although not right now) more efficient
equivalent to GetSelectedCount() == 0.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77903 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-27 20:46:18 +00:00
Vadim Zeitlin
d058c09e9f Add possibility to iterate over all selected items in wxSelectionStore.
This is necessary for retrieving all the selected items at once: while doing
this is not recommended for a control with a potentially very large number of
items, it must be possible to allow using wxSelectionStore for wxDataViewCtrl
implementation as wxDataViewCtrl must implement its GetSelections() method.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77902 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-27 20:46:15 +00:00
Vadim Zeitlin
31f0808ee2 reenable this tests under wxUniv/x11 port. EventPropagationTestCase::MenuEvent cause the problem, not these. MenuEvent will be fixed later
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77825 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-23 17:42:29 +00:00
Vadim Zeitlin
4363f9b578 These test will cause test_gui segmentation fault, disable for now.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77785 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-23 17:40:15 +00:00
Vadim Zeitlin
c2e18d75e5 Fix wxCALL_FOR_EACH() to work with more than 2 arguments with MSVC.
Due to a bug in MSVC handling of __VA_ARGS__ (see
https://connect.microsoft.com/VisualStudio/feedback/details/380090/variadic-macro-replacement)
wxCALL_FOR_EACH() didn't work correctly as long as more than two arguments
were used with it.

Work around the bug by protecting __VA_ARGS__ from being incorrectly passed as
a single token to the macro being called on every step: this was already done
for wxCALL_FOR_EACH itself with wxCALL_FOR_EACH_, but we need to do it for all
the helper macros too.

Also add a test checking that this does, actually, work.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77689 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-14 00:59:53 +00:00
Vadim Zeitlin
f4b80e5337 Remove MSVC6 support.
Don't support this compiler any more, this allows to get rid of tons of
MSVC6-specific workarounds, in particular we can now use Bind() and natural
template functions calls in the library code.

Also remove MSVC6 project and solution files and don't generate them when
bakefile_gen is ran any more (removing the remaining occurrences of msvc6prj
from the bakefiles results in weird bake-time errors, so it's simpler to just
leave them there).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76532 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-05-15 22:32:17 +00:00
Vadim Zeitlin
910f1a96d2 Add wxOleConvertVariant_ReturnSafeArrays flag for better SAFEARRAY handling.
While we can't change the type of wxVariant to which SAFEARRAYs are converted
by default, it's much more convenient to work with the variant objects of the
correct type, i.e. using wxVariantDataSafeArray, when dealing with SAFEARRAYs,
so add a flag which can be set to tell a wxAutomationObject to behave in this
way.

Closes #14700.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75004 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-10-14 15:08:35 +00:00
Vadim Zeitlin
3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00
Vadim Zeitlin
f94a952846 PCH-less build fix for DynamicLibraryTestCase.
Include wx/log.h needed by wxLogWarning().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72763 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-24 23:41:04 +00:00
Vadim Zeitlin
e282b73a5b Test for the shared library existence in DynamicLibraryTestCase.
Trying to understand why does the test fail in some build slaves builds.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72758 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-24 23:13:38 +00:00
Vadim Zeitlin
b785d15d50 Add missing header to fix MiscGUIFuncsTestCase compilation.
Need full wxPanel declaration here now.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72609 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-03 07:58:56 +00:00
Vadim Zeitlin
92c9a59d7a Fix wxFindWindowAtPoint() unit test to pass under GTK.
We need to ensure that all windows are realized before querying their
positions on screen, so add an extra wxYield().

Also adjust the tests slightly as the windows are now all created in the
beginning of the function.

Finally, use Destroy() instead of wxDELETE() for windows.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72608 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-03 00:16:53 +00:00
Vadim Zeitlin
44040e5eca Added a simple unit test for wxWindow::ClientToScreen().
Check that this function works consistently for the TLW and its children and
grand-children.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72607 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-03 00:16:30 +00:00
Vadim Zeitlin
ab45fb147b Avoid creating children of wxButton in MiscGUIFuncsTestCase.
This doesn't work in wxGTK, use a normal wxWindow instead of wxButton in this
case.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72606 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-10-03 00:16:07 +00:00
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
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
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
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
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
2ab92d62cf Add a simple unit test for wxParseCommonDialogsFilter().
Verify that this function (which is used for parsing the wildcard strings used
with file-related dialogs) works as expected and also asserts when given
invalid input.

See #4489.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67585 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-04-23 14:53:38 +00:00
Vadim Zeitlin
f9ee3f4710 Revert r66070: "Unload bogus XRC resources in "garbage" unit test."
This change is not needed any longer after r66219 which fixed the real
underlying problem, i.e. that attempting to load an invalid XRC file resulted
in failures when loading all subsequent XRC files.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66220 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-21 13:00:06 +00:00
Vadim Zeitlin
d97ee1b955 Unload bogus XRC resources in "garbage" unit test.
Leaving invalid XRC entries in wxXmlResource internal list of loaded resources
resulted in failures in the XRC unit test which executed after this one.

It seems that loading an invalid resource shouldn't prevent the other ones
from loading correctly later and this probably should be corrected at
wxXmlResource level but for now work around this problem in the test itself.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66070 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-08 16:28:51 +00:00
Vadim Zeitlin
2a0ca9dbaf Fix warnings about signed/unsigned comparisons inside wxMax() and friends.
wxMax, wxMin and wxClip work correctly when called with a mix of signed and
unsigned arguments but give warnings about comparing them when compiled with
g++.

Cast both arguments to the result type, which is defined consistently with
standard C rules for implicit promotion, before comparing them to avoid this.

Also add more tests to check that using these functions in this case doesn't
provoke warnings.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65933 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-27 20:23:55 +00:00
Václav Slavík
fd7c5da65e Add wxImplicitConversionType tests.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65921 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-25 09:43:04 +00:00
Stefan Csomor
6eb1e122cb using proper dylib for darwin
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64643 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-06-20 15:24:01 +00:00
Jaakko Salli
109e2ca434 Added wxIsPod<>. Use it in wxAny instead of wxIsMovable<>.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-06-14 15:12:37 +00:00
Francesco Montorsi
69fc85873d moved non-interactive tests for wxDynamicLibrary, wxGet/SetEnv, wxTempFile, wxCopyFile to appropriate CppUnit test suites;
removed wxFile and wxTextFile tests (complete testsuites already exist for them)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64583 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-06-13 14:30:55 +00:00
Francesco Montorsi
8e73dcda17 fix building without PCH
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64513 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-06-06 15:44:32 +00:00
Francesco Montorsi
49e323a5b5 remove some tests from the console sample:
- wxLog already has a better cppunit test class
- wxLocale test in the console sample didn't work on Windows and wasn't very useful

move some tests from the console sample to CppUnit tests:
- wxPathList => PathListTestCase
- wxModule => ModuleTestCase

remove some tests about removed functions of wxMimeTypesManager

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64511 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-06-06 14:21:27 +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
Vadim Zeitlin
791f7574a0 Fix buffer overflow in wxURLDataObject.
The code in CFSTR_SHELLURLDataObject::GetDataHere() was confused by
ANSI/Unicode and ended up overwriting output buffer because of it. Moreover,
this function was actually completely unnecessary as the base class version
did work correctly.

Closes #11102 (thanks to Tim Kosse).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61788 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-08-30 17:25:42 +00:00
Vadim Zeitlin
a15239a6fd correct test failures under MSW, it shouldn't assume that all predefined fonts have non-empty facenames
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@60675 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-05-17 11:52:26 +00:00
Vadim Zeitlin
174649c955 fix tests for the release builds
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59848 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-25 13:32:53 +00:00
Francesco Montorsi
8057186b81 PCH less build fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59823 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-25 00:25:37 +00:00