Commit Graph

21 Commits

Author SHA1 Message Date
Vadim Zeitlin
ab9115e0a0 Use correct warning option for older gcc in wxLog test
-Wdangling-else is only available since gcc 7.
2020-03-10 02:42:08 +01:00
Vadim Zeitlin
ea2bff0b50 Remove code guarded with wxUSE_GUI from wxLog unit test
This file is never compiled with wxUSE_GUI==1, so having these tests
here is not really useful.

It's unfortunately that the absence of warnings from wxLogStatus() is
not checked currently, but it doesn't seem worth recompiling the entire
test case or adding a new one just for this.
2020-03-10 02:42:08 +01:00
Vadim Zeitlin
57111b83c9 Minor fixes to new wxLog functions test case
Only use the diagnostic pragma for the compilers that understand it.

Also don't use hard TABs.
2020-03-10 02:42:08 +01:00
Lauri Nurmi
32ead5a0ff Fix dangling else warnings at all wx(V)LogXXX calls
Earlier this was fixed for some but not all variants of wx(V)LogXXX.

See #11829.
2020-03-10 02:42:08 +01:00
Lauri Nurmi
09e0b3927b Fix building tests when configured with --disable-log
Add missing wxUSE_LOG checks to wxTextCtrl test and disable wxLog test
entirely when wxUSE_LOG==0.

Closes https://github.com/wxWidgets/wxWidgets/pull/1703
2020-01-10 16:38:41 +01:00
Maarten Bent
7c1ab06ea5 Add more wxOVERRIDE 2018-09-22 14:44:07 +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
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
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
2c64172825 Reset the system last error value before checking it in wxLog test.
Explicitly set the last error indicator to 0 before checking that
wxLogSysError() logs it correctly as it wasn't always set to 0 otherwise.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76123 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-03-12 22:20:50 +00:00
Vadim Zeitlin
66b370d05f Rewrite wxLogXXX() macros to avoid "ambiguous else" warnings.
Use a dummy for loop instead of an if statement to avoid all problems with the
dangling else clauses: both the need for an artificially inversed "if" to make
the code like

	if ( something )
		wxLogError("...");
	else
		something-else;

to work as expected and to avoid warnings given by some versions of g++ and
clang for the code above advising to add explicit braces.

Closes #11829.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74735 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-08-31 17:41:16 +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
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
3cfa70b71a Exclude tests relying on last error being set under MinGW.
The value of the last error seems to change somewhere between our code and
::GetLastError() call, probably in MinGW CRT, so exclude the tests relying on
it being preserved.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65740 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-10-03 17:15:24 +00:00
Vadim Zeitlin
f9136b63ee Include wx/filefn.h to fix PCH-less compilation.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61694 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-08-18 11:44:31 +00:00
Vadim Zeitlin
b804f9924d Fix last error display in wxLogSysError().
After recent changes of wxLogXXX() functions into macros the last error was
overwritten by wxString::Format() called between the call to wxLogSysError()
and wxLog::CallDoLogNow() which called wxSysErrorCode() and so its original
value was lost and, unless the last error was specified explicitly, it always
came out as 0.

To fix this, call wxSysErrorCode() directly when calling wxLogSysError(). This
may be unnecessary (if the error is given explicitly) but there doesn't seem
to be any other way to fix it and the overhead of calling wxSysErrorCode()
shouldn't be that big.

Also add a unit test checking that wxLogSysError() behaves as expected.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61692 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-08-18 01:22:48 +00:00
Vadim Zeitlin
89d62794e4 Implement wxVLogTrace() accidentally removed by recent changes.
Also change the unit test to test wxVLogTrace() as well as wxLogTrace.

Closes #11011.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61505 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-23 13:40:44 +00:00
Vadim Zeitlin
c602c59b6e Add component-level filtering to wxLog.
Each log message is now associated with its component, "wx" by default for
messages generated by wxWidgets and wxLOG_COMPONENT in general (which is empty
by default). Each component may have its own log level and they are
hierarchical allowing fine configuration of what exactly is logged.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61414 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-12 14:56:23 +00:00
Vadim Zeitlin
4855770182 disable MSVC deprecation warnings as we intentionally test deprecated methods in this test
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61353 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-09 12:22:37 +00:00
Vadim Zeitlin
bc73d5aec8 Changed wxLog DoLogXXX() callbacks and introduced wxLogRecordInfo.
The main logging callback is now DoLogRecord() with DoLogTextAtLevel() and
DoLogText() provided for convenience. The old DoLog() and DoLogString() are
still called but deprecated and their overloads taking wxString which were
only added in 2.9.0 are removed.

wxLogRecordInfo allows associating more information than just the time stamp
with the log record; for now only the logging thread id was added but more
fields will make their appearance soon.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61346 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-08 13:47:33 +00:00
Vadim Zeitlin
ece5e6a47a added a simple wxLog unit test
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61343 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-07-07 12:19:34 +00:00