Commit Graph

2536 Commits

Author SHA1 Message Date
Vadim Zeitlin
5ebce65494 Get rid of CppUnit boilerplate in wxNumberFormatter unit tests
No real changes, just drop CppUnit::TestCase inheritance and the legacy
macros and use TEST_CASE_METHOD() instead.
2021-02-21 16:52:07 +01:00
Vadim Zeitlin
d2b2e0a4ed Replace CPPUNIT_ASSERT() macros in numeric validator unit tests
Simplify code and use CHECK() rather than REQUIRE(), which is what
CPPUNIT_ASSERT() is defined as, to continue running the tests even if
some of them fail.
2021-02-21 00:33:22 +01:00
Vadim Zeitlin
da973c3caf Get rid of CppUnit boilerplate in numeric validator unit tests
No real changes, just drop CppUnit::TestCase inheritance and the legacy
macros and use TEST_CASE_METHOD() instead.
2021-02-21 00:30:46 +01:00
Dimitri Schoolwerth
b5edfa2872 Add minor test for grid attributes
Test overwriting a cell's attribute with another attribute. With this
addition wxGridCellAttrData::Setattr() is now fully covered by tests.
2021-02-15 12:36:03 +01:00
Artur Wieczorek
c7667c16f8 Add tests of creating wxGraphicsBitmap from wxImage 2021-02-09 00:14:12 +01:00
Vadim Zeitlin
d6b8ed1e3c Merge branch '4238-fix-grid-multicell-editing' of https://github.com/discnl/wxWidgets
Fix grid multicell integrity after inserting/deleting rows/columns.

See https://github.com/wxWidgets/wxWidgets/pull/2192
2021-02-08 12:43:44 +01:00
Vadim Zeitlin
3978a0df0e Check stream error in LastRead() unit test too
It doesn't make sense to call LastRead() if an error happened while
reading, so check if it did.
2021-02-08 12:42:54 +01:00
Dimitri Schoolwerth
d282ccf696 Add grid tests for multicell integrity after insertions/deletions
Multicells currently don't get any special treatment when inserting
or deleting rows or columns so neither a multicell's main size nor
inside cells' sizes (which are offsets to the main cell) are updated.
Most tests fail and will be fixed by the next commit.

See #4238.
2021-02-07 22:59:02 +01:00
Dimitri Schoolwerth
bc7e5ffc56 Add basic tests for wxGrid cell attribute presence and count
Do some simple sanity checks with attributes, particularly overwriting
a cell with NULL attribute (as was already checked very usefully in
the grid sample for ref count reasons), and their total count in a grid
when inserting and deleting rows and columns.

While the tests are not particularly useful for the next intended grid
change, they do contain some functions that also work for upcoming tests
so these (harmless) tests are included as well.
2021-02-07 22:59:02 +01:00
Artur Wieczorek
414f211b8a Add tests of wxGraphicsBitmap
Add tests of creating wxGraphicsBitmap from specific to wxMSW and wxOSX
32-bit RGB wxBitmaps (non-alpha).
2021-02-06 21:43:47 +01:00
Vadim Zeitlin
6e145f8f9f Merge branch 'msw_edge_fixed' of https://github.com/TcT2k/wxWidgets
Allow using a fixed Edge version with wxWebViewEdge and other
wxWebView-related improvements and refactoring.

See https://github.com/wxWidgets/wxWidgets/pull/2212
2021-02-06 14:22:42 +01:00
Artur Wieczorek
27141e6a7c Fix test of wxImage::InitAlpha() 2021-02-06 01:37:05 +01:00
Artur Wieczorek
1adc38c42b Add tests of wxImage::InitAlpha() 2021-02-06 01:07:32 +01:00
Artur Wieczorek
e73cb85246 Add tests of wxGraphicsBitmap 2021-02-05 23:52:29 +01:00
Artur Wieczorek
cda4e94a7b Add to ImageRGBMatcher ability to check alpha values in wxImage tests 2021-02-05 23:04:55 +01:00
Artur Wieczorek
c8a47a4313 Fix comparing wxImages in tests
Iterate through pixels instead of individual RGB components to report
proper coordinates of found mismatch.
2021-02-05 23:03:59 +01:00
Tobias Taschner
d11ab7f751 Skip some unsupported tests with wxWebViewEdge 2021-02-05 22:18:30 +01:00
Vadim Zeitlin
550bb1e2ce Merge branch 'github-ci-more-builds'
Move Linux CI builds from Travis CI to GitHub CI.

See https://github.com/wxWidgets/wxWidgets/pull/2204
2021-01-31 17:36:37 +01:00
Vadim Zeitlin
584494f3b5 Skip wxDataViewCtrl unit test when using ASAN with wxGTK
Somehow ASAN reports a memory leak in this test:

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7fc54732ebc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x7fc546685cb8 in g_malloc ../../../glib/gmem.c:102
    #2 0x7fc543a49b41 in _gtk_rbtree_new ../../../../gtk/gtkrbtree.c:333
    #3 0x7fc543b0831a in gtk_tree_view_real_expand_row ../../../../gtk/gtktreeview.c:12922
    #4 0x7fc543b1087a in gtk_tree_view_expand_row ../../../../gtk/gtktreeview.c:12983
    #5 0x7fc5453ba344 in wxDataViewCtrl::DoExpand(wxDataViewItem const&, bool) src/gtk/dataview.cpp:5013
    #6 0x7fc5458e5a0e in wxDataViewCtrlBase::ExpandAncestors(wxDataViewItem const&) src/common/datavcmn.cpp:1297
    #7 0x7fc5453bce08 in wxDataViewCtrl::SetSelections(wxDataViewItemArray const&) src/gtk/dataview.cpp:5228
    #8 0x5557834c5745 in test controls/dataviewctrltest.cpp:178
    #9 0x5557834d688c in invoke ../3rdparty/catch/include/internal/catch_test_registry.hpp:25
    #10 0x5557831434ef in Catch::TestCase::invoke() const ../3rdparty/catch/include/internal/catch_test_case_info.hpp:176
    #11 0x55578317f10f in Catch::RunContext::invokeActiveTestCase() (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1bc10f)
    #12 0x55578317e9dd in Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1bb9dd)
    #13 0x55578317b5cc in Catch::RunContext::runTest(Catch::TestCase const&) (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1b85cc)
    #14 0x55578313c64a in Catch::runTests(Catch::Ptr<Catch::Config> const&) ../3rdparty/catch/include/internal/../catch_session.hpp:82
    #15 0x555783180e05 in Catch::Session::runInternal() (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1bde05)
    #16 0x555783180931 in Catch::Session::run() (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1bd931)
    #17 0x555783180899 in Catch::Session::run(int, char const* const*) (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1bd899)
    #18 0x55578315719a in TestApp::RunTests() test.cpp:635
    #19 0x5557831a63c7 in TestApp::OnIdle(wxIdleEvent&) (/home/runner/work/wxWidgets/wxWidgets/tests/test_gui+0x1e33c7)
    #20 0x7fc5446bbbfe in wxAppConsoleBase::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) const src/common/appbase.cpp:654
    #21 0x7fc5446bbdba in wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const src/common/appbase.cpp:666
    #22 0x7fc5449b29dd in wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) src/common/event.cpp:1416
    #23 0x7fc5449b47f4 in wxEvtHandler::SearchDynamicEventTable(wxEvent&) src/common/event.cpp:1888
    #24 0x7fc5449b32be in wxEvtHandler::TryHereOnly(wxEvent&) src/common/event.cpp:1609
    #25 0x7fc5449b70a7 in wxEvtHandler::TryBeforeAndHere(wxEvent&) include/wx/event.h:3949
    #26 0x7fc5449b2f72 in wxEvtHandler::ProcessEventLocally(wxEvent&) src/common/event.cpp:1546
    #27 0x7fc5449b2ec5 in wxEvtHandler::ProcessEvent(wxEvent&) src/common/event.cpp:1519
    #28 0x555783156ef7 in TestApp::ProcessEvent(wxEvent&) test.cpp:615
    #29 0x7fc5446badef in wxAppConsoleBase::ProcessIdle() src/common/appbase.cpp:431

but only if another wxDataViewCtrl test runs after it, i.e. there is no
leak when running just this test on its own.

This doesn't seem to make sense, as wxDataViewCtrl, and hence
GtkTreeView, is destroyed at the end of the test and it shouldn't be
possible for a test running later to affect the presence or absence of a
memory leak in it, so it might be a LeakSanitizer bug, but this doesn't
help actually getting rid of it.

The only other possibility would be to suppress this leak, but this
doesn't seem ideal, as we could suppress some other real leak too, so
for now just skip this test when using ASAN.
2021-01-31 17:33:13 +01:00
Vadim Zeitlin
4da635e2dc Simplify WaitForPaint::YieldUntilPainted()
Don't return anything from it, just warn directly -- this is what all
the existing callers did, so it's simpler if the function just does it
itself instead of forcing them to check its return value.

Also reset m_painted after yielding, so that YieldUntilPainted() could
be called again, if necessary.
2021-01-31 01:33:30 +01:00
Vadim Zeitlin
e0a927af94 Wait for wxDataViewCtrl relayout under GTK in the unit test
A single wxYield() doesn't seem to be enough, at least not when running
in GitHub Actions environment, so wait for a longer time.
2021-01-31 01:33:30 +01:00
Vadim Zeitlin
f2188be471 Recognize GitHub Actions as a CI environment in the test
This is necessary to activate the existing workarounds in the GUI tests.
2021-01-30 23:16:06 +01:00
Vadim Zeitlin
bde95c388c Fix linking of the GUI test when using static libraries
We need to explicitly link with the system libraries required in this
case, as static wxwebview library doesn't pull them in (it's also better
to link with them explicitly even when using shared libraries, but in
this case linking at least still worked due to transitive dependencies).
2021-01-30 22:49:24 +01:00
Maarten Bent
6082dd9eb1 Show all wxWebRequest error descriptions in test output 2021-01-30 22:14:19 +01:00
Vadim Zeitlin
1fed80f9b1 Merge branch 'webrequest-tests'
Make wxWebRequest CI tests more reliable by using local httpbin
instance.

See https://github.com/wxWidgets/wxWidgets/pull/2183
2021-01-27 17:55:42 +01:00
Vadim Zeitlin
97eecc1cce Merge branch 'sizerflags-center-align'
Fix combining wxSizerFlags alignment and CenterXXX().

See https://github.com/wxWidgets/wxWidgets/pull/2190
2021-01-27 17:55:18 +01:00
Vadim Zeitlin
d5ebe48d93 Use httpbin for error status with body test too
Although httpbin doesn't return any body for the other 4xx statuses, it
does make an exception for this one, so we can use it for testing
instead of the even less reliable httpstat.us which regularly returns
503 server error instead of the expected 418.

This probably also makes the workaround for Ubuntu 14.04 unnecessary, so
remove it.
2021-01-26 22:24:18 +01:00
Vadim Zeitlin
9130f8bfc6 Don't change orthogonal alignment in wxSizerFlags::CenterXXX()
It was unexpected that using wxSizerFlags().Right().CentreVertical()
didn't right-align the item because CentreVertical() reset the alignment
in the horizontal direction rather than just setting it in the vertical
one, so change this, document the new behaviour explicitly and add a new
unit test checking for it.

Closes #18989.
2021-01-25 12:58:04 +01:00
Vadim Zeitlin
caf5a62fd9 Use different sections for different flags in wxGridSizer test
No real changes, just organize the tests a bit better.
2021-01-25 00:53:24 +01:00
Vadim Zeitlin
08d8d12872 Get rid of CppUnit boilerplate in wxGridSizer unit test
No real changes, just simplify and use CHECK() instead of
CPPUNIT_ASSERT_EQUAL() (which is the same as REQUIRE()).
2021-01-25 00:48:30 +01:00
Vadim Zeitlin
bde7cfb1a7 Show WX_TEST_WEBREQUEST_URL being used in the test
Make it clear which URL do we actually use.
2021-01-25 00:28:11 +01:00
Vadim Zeitlin
d9d44c8585 Increase wxWebRequest tests timeout
10s seems to often be not long enough for the Travis/AppVeyor machines.
2021-01-24 02:01:58 +01:00
Vadim Zeitlin
949b66c0f5 Use a different httpbin mirror by default
This one seems slower, but might be more reliable.
2021-01-23 16:46:02 +01:00
Vadim Zeitlin
86f9778ea9 Add a unit test exercising the bug fix in the parent commit
This test used to fail, but passes now.
2021-01-23 16:40:30 +01:00
Vadim Zeitlin
6b3ff511ee Get rid of all CppUnit boilerplate in wxSelectionStore test
This simplifies the code and allows running the test cases individually
from the command line.
2021-01-23 16:40:30 +01:00
Vadim Zeitlin
a1cca242a4 Use CHECK() instead of CPPUNIT_ASSERT in wxSelectionStore test
No real changes, just simplify the code. Notably we don't need explicit
"u" suffix on the literal constants any longer as CATCH is smart enough
to compare signed and unsigned integers correctly without it.
2021-01-23 16:40:30 +01:00
Vadim Zeitlin
8e5836908c Use wxSelectionStore object instead of a pointer in the test
Just simplify the code, there is no need to allocate and free a pointer
when we can just use an object.

No real changes.
2021-01-22 22:32:20 +01:00
Vadim Zeitlin
3c7326205f Merge branch 'grid-fix-drawing-invalid-cells' of https://github.com/discnl/wxWidgets
Fix drawing of grid cells appearing inside a multicell.

See https://github.com/wxWidgets/wxWidgets/pull/2176
2021-01-21 00:50:09 +01:00
Vadim Zeitlin
7911fdc253 Merge branch 'webrequest_additions' of git://github.com/TcT2k/wxWidgets
wxWebRequest improvements: add DisablePeerVerify(), improve
documentation.

See https://github.com/wxWidgets/wxWidgets/pull/2175
2021-01-21 00:44:37 +01:00
Artur Wieczorek
efb96a352d Add more tests of converting wxBitmap to wxImage 2021-01-20 19:29:32 +01:00
Paul Cornett
892795ac9c Apply a better fix for HitTest failures in the tests with GTK3
The actual cause of the problem was the tests making the single-line
text control height far too large. So just use the default height for
single-line controls.
2021-01-19 22:50:41 -08:00
Dimitri Schoolwerth
6d3dbc3fe5 Add test demonstrating drawing of an invalid grid cell
The way the test grid is set up forces drawing of an inside cell (part
of a multicell) which shouldn't normally occur. In this case it
leads to an infinite recursion while drawing the inside cell. Drawing
of inside cells will be fixed by the next commit.
2021-01-19 22:01:23 +01:00
Tobias Taschner
036b7f29a7 Add wxWebRequest::DisablePeerVerify()
This method allows insecure HTTPS connections when required
2021-01-19 13:16:25 +01:00
Paul Cornett
4a3ff8c180 Fix bitmap tests with GTK2
wxGTK2 does not support drawing bitmaps with both alpha
and a mask, so it doesn't bother to implement having both.
So skip the test for that case.
2021-01-19 01:35:28 -08:00
Artur Wieczorek
72ac21cf18 Fix wxBitmap tests under wxOSX
Under wxOSX wxBitmaps have always 32-bit depth.
2021-01-18 23:01:20 +01:00
Artur Wieczorek
6b572bf694 Add tests of converting wxImage to wxBitmap 2021-01-18 22:14:43 +01:00
Vadim Zeitlin
febd185fc6 Merge branch 'web-request'
Add wxWebViewRequest and related classes allowing to use HTTPS and
HTTP/2.

See https://github.com/wxWidgets/wxWidgets/pull/977
2021-01-17 18:19:47 +01:00
Vadim Zeitlin
1ddf2ee303 Check that calling GetString() with invalid index asserts
This is the behaviour that would be normally expected and now really
happens for all the controls, including wxChoice.
2021-01-17 00:41:15 +01:00
Artur Wieczorek
321f38831e Fix sizes of images stored in generic wxImageList
Sizing the images stored in the list should stick to the convention
adopted in the native wxImageList implemented in wxMSW.
Images stored in the list should have the sizes as it is declared for
the list even if provided bitmaps have different sizes.
In case of discrepancies their dimensions should be adjusted accordingly
(cropped or extended).
2021-01-16 23:01:49 +01:00
Artur Wieczorek
bde82aa9fb Fix adding image using bitmap and mask colour to nonmasked wxImageList (wxMSW)
If image using bitmap and mask colour is added to nonmasked wxImageList we
need to convert effective mask to alpha channel values prior to adding the
image to the native list to preserve transparency.
2021-01-16 23:01:48 +01:00