Commit Graph

2389 Commits

Author SHA1 Message Date
Maarten Bent
977e9df630 Add test case for wxGraphicsContext DrawBitmap
Test if the bitmap is scaled correctly.
2020-03-11 20:00:09 +01:00
Vadim Zeitlin
702ba58590 Replace legacy CppUnit assertions with CATCH ones in grid test
Get rid of compatibility macros and use CATCH macros directly.

Also remove the now unnecessary casts.
2020-03-11 18:42:14 +01:00
Vadim Zeitlin
29d890867c Rewrite grid unit tests to use individual test cases
Instead of using a single test case, with multiple sections, generated
by CppUnit compatibility macros, use multiple independent test cases.

This makes it more convenient to run individual tests, simplifies the
code and allows to get rid of ugly "pseudo tests".
2020-03-11 18:41:16 +01:00
Maarten Bent
38008cd8d5 Add macro to compare colours in bitmap test suite 2020-03-10 21:04:15 +01:00
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
Vadim Zeitlin
1e7c2c8254 Benchmark GetTextExtent() and GetPartialTextExtents()
Add very simple benchmark of these 2 functions to allow (roughly)
comparing the advantage of using one compared to the other.
2020-03-07 19:25:03 +01:00
Vadim Zeitlin
b9df145b79 Stop using non-existent CXXWARNINGS for failing tests checks
This variable doesn't exist any more, but now it's possible to use
CPPFLAGS directly and get rid of the hack which required it to be used
in the first place.
2020-02-11 23:43:10 +01:00
Vadim Zeitlin
ec091c9f2b Don't override CFLAGS etc in configure-generated makefile
CPPFLAGS, CFLAGS, CXXFLAGS and LDFLAGS are supposed to be under
user-control and putting configure-determined options in them broke
something as simple as running "make CXXFLAGS=-Wno-some-extra-warning"
because this overrode the CXXFLAGS set by configure and required for
build.

Improve this by using WX_*FLAGS in the generated makefile and leaving
the user-controlled FLAGS alone. This is still not ideal as running
"configure CFLAGS=-DFOO" and then "make CFLAGS=-DBAR" will define both
FOO and BAR, as configure copies CFLAGS to WX_CFLAGS, and so setting it
on make command line won't override it, as it should, but this should be
a much more rare and also much less severe problem, so we should be able
to live with it for now.

Normally this commit shouldn't result in any user-visible changes, i.e.
it shouldn't break any previously working scenarios and only make some
previously broken ones work.
2020-02-11 23:19:31 +01:00
Vadim Zeitlin
b18169a0e4 Merge branch 'paint-debug'
Detect invalid use of wxPaintDC/wxPaintEvent better.

See https://github.com/wxWidgets/wxWidgets/pull/1732
2020-02-11 22:35:33 +01:00
Vadim Zeitlin
8fcf46f65c Forbid creation of wxPaintEvent objects from user code
This doesn't work anyhow, so it's better to prevent the code doing this
from compiling instead of getting run-time asserts or worse.

Also simplify construction of these events inside wxWidgets by passing
the window itself to the ctor instead of passing just its ID and calling
SetEventObject() separately later.

For consistency, do the same thing for wxNcPaintEvent too.
2020-02-10 23:03:01 +01:00
Vadim Zeitlin
f21c7f2d49 Add a test for C++ comments in code passed to RunScript()
This used to be broken, check that it does work now.
2020-02-05 15:55:50 +01:00
Vadim Zeitlin
a26e81ccb1 Remove test for \v escaping in wxWebView::RunScript()
This escape character doesn't seem to be handled by IE in the default
emulation mode and it's not worth complicating the test code just to
test for it, so simply remove it from the test.
2020-02-05 15:40:27 +01:00
Vadim Zeitlin
00cdab77c5 Define wxStrtox() overloads taking nullptr
Instead of specializing wxStrtoxCharType and then testing whether endptr
is null, just define separate, and simpler, overloads of wxStrtox()
functions taking nullptr_t -- we can avoid the unnecessary test
completely in this case, as nullptr is, by definition, always null
anyhow.

Also add a test of using wxStrtol() with nullptr too.

This should fix the build with older gcc and MSVS versions.
2020-02-05 03:54:25 +01:00
Ilya Sinitsyn
217349d772 Test wxGrid RefreshBlock function when a grid is empty
SelectCol and SelectRow should not fail an assertion if a grid has no
rows or columns.
2020-02-05 03:32:31 +01:00
Vadim Zeitlin
e171757160 Merge branch 'grid-selecting'
Fix several problems related to selecting cells from keyboard in wxGrid.

Closes https://github.com/wxWidgets/wxWidgets/pull/1719
2020-02-04 02:13:20 +01:00
Paul Cornett
948ddc6e0f Eliminate -Wcast-qual warnings with GCC and Clang
Use const_cast, mutable, and various other changes to avoid -Wcast-qual
2020-02-02 22:50:32 -08:00
Ilya Sinitsyn
7fa9416fb4 Test wxGrid cells selection using End key 2020-02-01 01:53:59 +01:00
Ilya Sinitsyn
677b9d21ea Test moving the grid cursor using End key for wxGrid 2020-02-01 01:53:59 +01:00
Ilya Sinitsyn
bf5be68510 Test wxGrid scrolling when selecting cells. 2020-02-01 01:53:59 +01:00
Vadim Zeitlin
55efc9e607 Allow using wxStrtox() functions with nullptr with MSVS too
Add a unit test checking that it compiles (and works).

This extends the changes of 63b1f00eb8 to
cover MSVS as well.
2020-01-31 17:13:06 +01:00
Vadim Zeitlin
c34a7a2e30 Convert CRT functions test case to use CATCH macros directly
Get rid of legacy CppUnit-compatible macros.

No real changes.
2020-01-31 16:54:06 +01:00
Vadim Zeitlin
a73194f6b4 Allow parsing all fractional sizes in wxFont descriptions
Remove the check that the size representation was the same as float and
as double, which was supposed to catch various edge cases (NaNs, huge
numbers etc) but actually caught plenty of perfectly valid font sizes
such as 13.8 that simply lost precision when converting from double to
float.

Just check that the size is positive and less than FLT_MAX to avoid
using values that really don't make sense as font sizes.

Also add a unit test checking that using fractional font sizes in
description string works as expected.

Closes #18590.

Closes https://github.com/wxWidgets/wxWidgets/pull/1707
2020-01-19 17:46:55 +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
Vadim Zeitlin
5de964cecc Add the script run by OSS-Fuzz
This script used to live in oss-fuzz repository itself (under
projects/wxwidgets), but it seems better to have it in the main
repository, as this will make modifying it, e.g. to add new fuzzers,
simpler.
2019-12-16 18:07:38 +01:00
Maarten Bent
083f4b3c32 Rename manifests to use underscores 2019-12-13 21:44:26 +01:00
Vadim Zeitlin
7b36d72b44 Merge branch 'vc-pmdpi' of https://github.com/MaartenBent/wxWidgets
Add DPI Awareness option to nmake makefiles and MSVC projects.

See https://github.com/wxWidgets/wxWidgets/pull/1664
2019-12-03 02:29:25 +01:00
Vadim Zeitlin
811be7ced7 Fix wxGridCellAttr::GetNonDefaultAlignment() for invalid inputs
The recent change of 19844d27ac fixed this
function for valid values of input/output parameters on input, but broke
it if the parameters had invalid value: in this case, we still need to
fill them even if this attribute doesn't have any specific alignment of
its own.

Account for this case too now, explain the logic of this function in the
comments inside it and extend the unit test to check for this case too.

Now the function should really conform to its documented (and expected,
including by the existing code in various grid renderers) behaviour.

Closes https://github.com/wxWidgets/wxWidgets/pull/1665
2019-12-03 02:26:49 +01:00
Maarten Bent
0f2308e3eb Update test sln and vcxproj files
Remove old configurations, add dpi manifest.
2019-11-30 23:24:54 +01:00
Maarten Bent
bed8cd7b52 Rebake after adding DPI awareness option 2019-11-30 22:52:48 +01:00
Vadim Zeitlin
64ee3bebb4 Merge branch 'long-string-format'
Fix using "%s" with long (>65KiB) strings when using our own printf()
implementation.

See https://github.com/wxWidgets/wxWidgets/pull/1654
2019-11-18 15:07:00 +01:00
Vadim Zeitlin
8cba51978e Add a check for using wxString::Format() with a very long string
This used to fail until it was fixed in the previous commit.

See #18586.
2019-11-17 18:30:33 +01:00
Igor Korot
68de1b2acf Fix initial value returned from wxRichTextCtrl::IsModified()
A just created control shouldn't be considered modified, so reset its
modified state in Create().

And add a unit test checking that IsModified() really behaves as
expected.

Closes https://github.com/wxWidgets/wxWidgets/pull/1652
2019-11-17 17:04:15 +01:00
Vadim Zeitlin
b690caba84 Replace CPPUNIT_XXX macros with CHECKs
This results in better error messages and also allows the test to
continue executing even if a check fails.
2019-11-16 17:05:06 +01:00
Vadim Zeitlin
505e694347 Get rid of useless VarArgTestCase test fixture
We don't need it any more, just define individual tests as independent
test cases.

This required using some other pointer instead of "this" in one of the
tests, but it doesn't really matter which pointer we use there anyhow.

No real changes.
2019-11-16 17:01:57 +01:00
Vadim Zeitlin
aa1891e524 Remove unnecessary and unused EllipsizationTestCase class
No real changes, just don't use a text fixture which does nothing, this
is useless and confusing.
2019-11-13 18:25:42 +01:00
iwbnwif
7155e82255 Show the used font in case of failure in Ellipsization unit test 2019-11-13 18:04:53 +01:00
Vadim Zeitlin
c26353f13f Add another workaround for failures in wxDateTime::UNow test
If current time doesn't have the milliseconds parts, we need to sleep
for a little before retrying.
2019-11-13 15:39:36 +01:00
Vadim Zeitlin
bf43d35636 Merge branch 'socket-thread'
Add a unit test for reading from wxSocket in a thread.

See https://github.com/wxWidgets/wxWidgets/pull/1632
2019-11-05 20:02:22 +01:00
Vadim Zeitlin
19844d27ac Fix default attribute wxGridCellAttr::GetNonDefaultAlignment()
This function is not supposed to overwrite the given alignment values
unless the alignment is specifically set for the given cell, but it
always overwrote them when called on m_defaultCellAttr, i.e. the
attribute used by the cells that don't have any special attribute.

This meant that custom attributes had to be set (or, more efficiently, a
custom attribute provider returning non-null attributes for all cells
had to be used) previously just to make the right alignment used by
default by number or date renderers work.

Fix this by ignoring the values set in the default attribute in this
function.

Also add a unit test (which required adding a special helper class just
to allow testing wxGrid::GetCellAttr() used by the renderers) that used
to fail but passes now.
2019-11-04 00:35:32 +01:00
Vadim Zeitlin
ef224dbe41 Add unit test for reading from wxSocket in a thread
Check that reading from blocking socket in a thread works.
2019-11-01 16:00:01 +01:00
Vadim Zeitlin
e376e74210 Fix build-breaking typo in the GUI test suite
Fix after afe1816996.

See #17400.
2019-11-01 00:53:12 +01:00
Vadim Zeitlin
4df94771da Merge branch 'dataview_cocoa' of https://github.com/thesiv/wxWidgets
Ensure that last wxDataViewCtrl columns is always expanded to fit the
control width and a unit test checking for the scenario in which this
wasn't the case before, but is now.

See https://github.com/wxWidgets/wxWidgets/pull/1313
2019-11-01 00:49:29 +01:00
Vadim Zeitlin
1439845802 Remove extra new lines after GTK log messages
This seems unnecessary as the default log handler already outputs a new
line at the end of the message anyhow and at least some messages (e.g.
debug ones in GdkPixbuf) also contain an extra new line in them, so
adding another one here resulted in having at least one and sometimes
two extra blank lines.
2019-11-01 00:10:27 +01:00
Vadim Zeitlin
afe1816996 Ignore GTK debug logs in the unit test unless they're enabled
Don't output "*** GTK log message while running" messages for every
g_debug() call when we the debug messages themselves will not be
displayed because G_MESSAGES_DEBUG is not set or its value doesn't
include the domain used by the message.

This results in much more reasonable output from the test suite.

See #17400.
2019-11-01 00:09:52 +01:00
Vadim Zeitlin
349e73994b Merge branch 'dpi-awareness-option' of https://github.com/MaartenBent/wxWidgets
Add wxUSE_DPI_AWARE_MANIFEST option allowing to choose to use a manifest
specifying per-monitor DPI awareness.

See https://github.com/wxWidgets/wxWidgets/pull/1622
2019-10-30 21:25:45 +01:00
Maarten Bent
a72c9b6dbc Run autoconf and rebake after adding wxUSE_DPI_AWARE_MANIFEST 2019-10-30 00:02:08 +01:00
Vadim Zeitlin
0a02f4c190 Increment version number to 3.1.4
Done by running misc/scripts/inc_release, manually updating version.bkl,
rebaking and rerunning autoconf.

Also a header for the next version to the change log.
2019-10-28 14:11:00 +01:00