Commit Graph

2072 Commits

Author SHA1 Message Date
Vadim Zeitlin
4c075c2128 Replace Bind() call with an event table in Enter handling tests
For once, using the event table macros is preferable because this
bypasses the (generally helpful, but not here) test done by Bind()
verifying that wxEVT_TEXT_ENTER handler is bound to a window with
wxTE_PROCESS_ENTER style.

Doing it like this will allow to check that controls without this style
really do not receive the corresponding event.
2019-09-10 18:48:20 +02:00
Vadim Zeitlin
e85b5e5261 Replace a single function with a class in Enter processing tests
No real changes yet, this is a pure refactoring before the upcoming
changes.
2019-09-10 18:48:20 +02:00
Vadim Zeitlin
32eb6f1a2c Remove explicit "ProgramDataBaseFileName" from test MSVS projects
This is not really necessary and triggers a bug with a spurious error
C2859 when building the project with MSVS 2019, see

https://developercommunity.visualstudio.com/content/problem/592262/error-c2859-is-not-the-pdb-file-that-was-used-when.html

(which was closed as "not a bug", after acknowledging the bug...).
2019-09-08 22:17:55 +02:00
Ilya Sinitsyn
e5d59c6b7f Respect minimum grid column width when using native header too
Override wxHeaderColumn::GetMinWidth() to return the actual minimum
width instead of just returning 0.

Add a unit test verifying that this works as intended.
2019-09-05 20:11:09 +02:00
Ilya Sinitsyn
2290d97453 Fix dragging grid columns when using scrolled native header
Drag-resizing the columns didn't work correctly when using the native
header and scrolling it horizontally, as the wrong offset was used in
this case.

Fix the offset in wxGrid code and add a unit test checking that this
works as intended (at least under MSW, as wxUIActionSimulator just
doesn't work reliably enough to test for this under the other platforms,
and, besides, only MSW has the native header control implementation
anyhow).
2019-09-05 20:11:09 +02:00
Ilya Sinitsyn
1bce1a1d4c Make using non-wxControl-derived wxGrid editors really work
While feacaf8714 changed the API to allow
using any wxWindow (and not only a window of a wxControl-derived class)
as the associated window of the grid editor, actually doing resulted in
an immediate crash due to dereferencing a null pointer in wxGrid code
which still expected to have a wxControl.

Fix this by replacing all calls to wxGridCellEditor::GetControl() inside
wxGrid with wxGridCellEditor::GetWindow(), to ensure that a non-null
editor window is used even in this case.

Closes https://github.com/wxWidgets/wxWidgets/pull/1509
2019-08-27 22:09:03 +02:00
Tomay
050ca4ce3a Add wxRegEx::QuoteMeta() helper
Quote all characters special for wxRegEx in the given string: this can
be useful when searching for a literal string using wxRegEx.

Closes https://github.com/wxWidgets/wxWidgets/pull/1489
2019-08-25 12:32:51 +02:00
oneeyeman1
14bcf09924 Move URL<->filename conversion functions to wxFileName
This ensures that they are always available and can be used in
wxLaunchDefaultBrowser() in all build variants, whereas before this
function didn't handle file:// URLs correctly when the library was built
with wxUSE_FILESYSTEM==0.

Closes https://github.com/wxWidgets/wxWidgets/pull/1469

Closes #10414.
2019-08-25 00:48:39 +02:00
Vadim Zeitlin
6096bff66b Merge branch 'memorydc-font'
Initialize wxMemoryDC with a default font and fix a bug in text extent
computations under MSW that doing this uncovered.

See https://github.com/wxWidgets/wxWidgets/pull/1484
2019-08-20 13:46:36 +02:00
Maarten Bent
533d82655f Remove CppUnit boilerplate and macros from ellipsization tests 2019-08-14 21:03:48 +02:00
Maarten Bent
b245e4a571 Use dynamic widths in ellipsization tests so they will work for any font size 2019-08-14 21:02:33 +02:00
Vadim Zeitlin
5a394deba4 Merge branch 'accel_keys' of https://github.com/imciner2/wxWidgets
Fixes for accelerator handling in wxGTK.

See https://github.com/wxWidgets/wxWidgets/pull/1463
2019-08-09 23:54:37 +02:00
Ian McInerney
ff1eb1afcc Fix comments from review 2019-08-05 20:51:46 +02:00
Ian McInerney
585302a69b Convert new menu unit test to C++98 style 2019-08-05 09:14:03 +02:00
Ian McInerney
942fd47ae8 Minor formatting fix 2019-08-05 01:18:50 +02:00
Ian McInerney
ef59628376 Fix CI errors in the unit tests 2019-08-05 01:16:16 +02:00
Ian McInerney
1eea919f13 Mark more keys as being invalid for GTK accelerator keys 2019-08-04 21:46:27 +02:00
Ian McInerney
f3edad2761 Remove invalid GTK accelerator keys 2019-08-04 21:17:10 +02:00
Ian McInerney
2cb96c16ff Add unit test for menu accelerator assignment 2019-08-04 18:41:06 +02:00
Ian McInerney
bdc301946f Upgrade accelerator entry unit tests
* Convert to the Catch framework
* Add a test for proper display name parsing
2019-08-04 18:24:16 +02:00
Maarten Bent
054cb35b39 Workaround for a crash with gcc 9.1 from MSYS2 MinGW 32bit 2019-08-03 21:08:10 +02:00
Lauri Nurmi
4739b9dedd Add C++20-style starts_with()/ends_with() functions to wxString
C++20 introduces these two functions, along with some overloads, to
std::string. Add similar functions to wxString, which simply call the
already existing StartsWith() and EndsWith().

Closes https://github.com/wxWidgets/wxWidgets/pull/1452
2019-07-31 00:52:29 +02:00
Vadim Zeitlin
bcf604b5cb Disable wxTE_PROCESS_ENTER unit tests under wxGTK
wxUIActionSimulator doesn't work reliably there and doesn't work at all
when using Xvfb.
2019-07-26 19:29:00 +02:00
Vadim Zeitlin
fb2c17c193 Merge remote-tracking branch 'sunset/process-enter'
Fix wxTE_PROCESS_ENTER logic for wxMSW and wxGTK too.

See https://github.com/wxWidgets/wxWidgets/pull/1415

Closes #18273.
2019-07-26 18:02:08 +02:00
Vadim Zeitlin
9d92ba185c Fix truncating CJK mnemonics in control labels
13068d3603 introduced code for stripping
CJK mnemonics (i.e. trailing " (&X)") from the menu items, but due to
the use of wxStripMenuCodes() in wxControl::GetLabelText(), it also
applied to the control labels, resulting in wrongly measuring their size
(because the text used for measurement didn't include the "(&X)" part)
and truncating them in display.

Fix this by adding an explicit wxStrip_CJKMnemonics and using it only in
the code dealing with the menu item labels. This requires more changes
than just modifying GetLabelText() to use some wxStrip_NoCJKMnemonics
flag, but is more compatible as it's not impossible that some existing
code using wxStripMenuCodes() could be broken by this change too, while
now the existing behaviour is preserved.

Also improve wxStrip_XXX documentation.

Closes https://github.com/wxWidgets/wxWidgets/pull/1439

See #16736.

Closes #18452.
2019-07-26 17:59:47 +02:00
Vadim Zeitlin
5bd9c5b65b Test wxTextCtrl::HitTest() with negative coordinates under wxGTK
In wxGTK using negative coordinates with HitTest() happens to work and
it's useful to test that it does, as this test will run when the control
is scrolled even under Travis CI, unlike the test with positive
coordinates which doesn't work under Xvfb there and was disabled in the
previous commit.

Also document that passing negative coordinates to this function only
works in wxGTK.
2019-07-19 01:44:29 +02:00
Vadim Zeitlin
cfb12091ca Skip wxTextCtrl::HitTest() unit test failing under Xvfb
For some reason, wxTextCtrl scrolls much too far when running under
Xvfb, so the test assumption that it still has some visible characters
after calling SetInsertionPointEnd() fails and must be disabled in this
environment.
2019-07-19 01:41:13 +02:00
Vadim Zeitlin
ef0f4243fb Tweak wxHtmlPrintout::Pagination unit test to pass under Travis
For some reason, the height of a text line is 15px there and not 18px as
locally, so 400px high image still fit on the second page in the last
test. Make it higher to ensure that it doesn't.
2019-07-19 01:40:44 +02:00
Vadim Zeitlin
08c7a0ca82 Hack to make wxHtmlPrintout unit test pass under wxGTK3
Set the "printer" PPI explicitly for wxMemoryDC used in the test to
ensure that it's the same in all ports: currently wxGTK3 stands out
because it uses 72 DPI unlike wxMSW and wxGTK2, which use 96.
2019-07-18 17:45:20 +02:00
Vadim Zeitlin
c1cbacd0ad Skip wxWebView unit tests when using wxGTK2
All tests currently fail because the initial LOADED event is never
received.
2019-07-18 17:45:20 +02:00
Vadim Zeitlin
96c3b11b99 Disable another wxSTC unit test mysteriously failing under Xvfb
For some reason, the control does lose focus there, even if it doesn't
happen when using a normal X11 server.

Just disable the test in this environment.
2019-07-18 17:45:20 +02:00
Vadim Zeitlin
8b6f79c886 Disable wxStyledTextCtrl unit test failing under wxGTK
wxStyledTextCtrl does _not_ always retain focus under wxGTK currently
while the STC popup is shown, even though it does get it at the end.

See https://github.com/wxWidgets/wxWidgets/pull/1267
2019-07-18 17:45:20 +02:00
Vadim Zeitlin
c92b39a13d Disable tests requiring a WM under Xvfb
Both iconization and activation of TLWs is dependent on the presence of
a WM, but there is no WM running under Xvfb, so skip these tests in this
case.
2019-07-18 17:45:20 +02:00
Vadim Zeitlin
8634808a6c Make wxRadioButton focus test MSW-specific
This test doesn't need to, and actually does not, pass under wxGTK,
where a radio button can have focus without being selected, unlike in
wxMSW.
2019-07-18 17:45:20 +02:00
Vadim Zeitlin
e3caafabc3 Provide more information for failures involving FindFocus()
It is useful to know where the focus actually is when a test checking
that it's set to a particular window fails.
2019-07-18 17:45:20 +02:00
Vadim Zeitlin
ee0f21388f Add a helper IsRunningUnderXvfb() function to the test suite
This will allow disabling some tests which fail when running only under
Xvfb.

The new function doesn't work automatically because there doesn't seem
to be any way to distinguish it from the usual server, so it just checks
whether wxUSE_XVFB=1 is set in the environment, as is done by Travis CI
build script.
2019-07-18 17:45:20 +02:00
Vadim Zeitlin
7eeff36635 Give more information in case of wxImage comparison failure
Show the value of the first differing pixel to get at least some idea of
what is wrong.
2019-07-18 17:45:20 +02:00
Vadim Zeitlin
76e21c2ffa Merge branch 'gtk-persist-tlw'
Fix bugs affecting wxPersistentTLW under GTK.

See https://github.com/wxWidgets/wxWidgets/pull/1419
2019-07-18 17:44:35 +02:00
Vadim Zeitlin
e5f4e1b1b5 Merge branch 'webview-test'
Some cleanup of the webview test.

No real changes.

See https://github.com/wxWidgets/wxWidgets/pull/1420
2019-07-16 20:22:21 +02:00
Vadim Zeitlin
e27eebdd2a Work around GTK problems in wxPersistentDVC unit test
We need to wait until wxDataViewCtrl is realized for its columns widths
to be actually set, as calling gtk_tree_view_column_set_fixed_width()
just queues a resize that will take effect later, as documented in the
previous commit.
2019-07-16 18:25:40 +02:00
Vadim Zeitlin
1e0d47452c Replace CppUnit check macros with CATCH ones
No real changes, just use more natural CHECK() instead of
CPPUNIT_ASSERT() and CPPUNIT_ASSERT_EQUAL().
2019-07-16 02:26:57 +02:00
Vadim Zeitlin
2b71ce3664 Get rid of CppUnit boilerplate in wxWebView unit test
This not only cuts down on its size, but will make it simpler to skip
this test in the environments where web access is unavailable in the
upcoming commit.
2019-07-16 02:26:57 +02:00
Vadim Zeitlin
f8bdf123f2 Remove unnecessary header from the webview unit test
No real changes.
2019-07-16 02:26:57 +02:00
Vadim Zeitlin
8d405b80e4 Wait for the TLW to become iconized under GTK in the test
Iconize() doesn't take effect immediately, so wait until it does for up
to some reasonable amount of time.
2019-07-16 02:26:11 +02:00
Vadim Zeitlin
13aa2a6721 Add unit tests for checking wxTE_PROCESS_ENTER handling
Verify that pressing Enter in a dialog activates its default button when
a text-like (i.e. wxTextCtrl or wxComboBox) has focus either if it
doesn't have wxTE_PROCESS_ENTER style or if it does, but its handler
skips the event, but not if the style is used and the event is handled.
2019-07-14 16:55:44 +02:00
Vadim Zeitlin
cf16c29e39 Remove CppUnit boilerplate from wxEvent::Clone() test case
Just remove the unnecessary macros and test case class.

No real changes.
2019-07-14 14:12:25 +02:00
Vadim Zeitlin
bd09b4132d Remove wxTimerEvent default constructor
This ctor just created unusable wxTimerEvent objects (all of the methods
specific to this class would just crash if called on them) and doesn't
seem to be useful at all.

It was added in e47859daeb apparently only
in order to allow using wxIMPLEMENT_DYNAMIC_CLASS() instead of the
previously used wxIMPLEMENT_ABSTRACT_CLASS() for wxTimerEvent, but there
doesn't seem to be any reason to prefer macro over another, and there
are good reasons to not allow creating objects in an invalid state.

The only place where we relied on having default ctor for this event was
in wxEvent::Clone() unit test, so update it to handle wxTimerEvent
specially now that this ctor doesn't exist any longer.
2019-07-14 14:10:55 +02:00
Vadim Zeitlin
4a6f16cf15 Merge branch 'statictext-setlabel'
wxControl label-related fixes and improvements.

See https://github.com/wxWidgets/wxWidgets/pull/1364
2019-07-08 10:09:49 +02:00
Vadim Zeitlin
44634cbf90 Merge branch 'qt_tree_control' of https://github.com/GeoTeric/wxWidgets into qt-fixes
See https://github.com/wxWidgets/wxWidgets/pull/1225
2019-06-29 20:49:25 +02:00
Vadim Zeitlin
30726437c0 Fix the result width check in the ellipsization unit test
When processing mnemonics, the resulting string should still contain
them and they need to be stripped before measuring its width, but the
code didn't do it.

This didn't prevent the tests from passing, but only due to another bug
in ellipsization code itself, which lost the mnemonics completely. As
this bug is about to be fixed, the test needs to take mnemonics into
account properly now.
2019-06-20 01:46:28 +02:00