Commit Graph

2120 Commits

Author SHA1 Message Date
Vadim Zeitlin
8d962b0121 Add a diagnostic message to wxDateTime::UNow() unit test
Try to understand what's going in Travis CI builds.
2019-10-19 23:05:32 +02:00
Vadim Zeitlin
c4e914784a Guard against Now() and UNow() returning different second values
Avoid spurious error in the unit test by calling Now() and UNow() a few
times in a row until they return the same second, as we may be unlucky
enough for this not to be the case when we call them just once.
2019-10-19 20:02:42 +02:00
Artur Wieczorek
3873a78f61 Fix building benchmarks with wxUSE_LIBTIFF == 0 2019-10-18 19:22:45 +02:00
Vadim Zeitlin
8064d9420f Fix the just added wxDataViewCtrl::DeleteAllItems() test
Using GetTopItem() was wrong, we actually need to use the invalid item,
which corresponds to the "virtual root" of wxDataViewTreeStore.
2019-10-17 22:26:37 +02:00
Vadim Zeitlin
7a980c455e Fix crash in wxDataViewTreeCtrl::DeleteAllItems() in wxGTK
Restore the checks for the model stamp, reverting the changes of
18594afe76: we still need to ignore the
calls to at least iter_children() and iter_nth_child() model methods
that can be called from inside gtk_tree_view_set_model() when we reset
the model, as running these methods crashes when trying to use the
pointers to already deleted items.

For consistency and robustness, add checks for the model stamp to all
the methods and not just those two, just in case other ones end up being
called later in some way.

Also add a unit test checking that DeleteAllItems() doesn't crash and
does delete all items.

Closes #18533.
2019-10-17 14:57:04 +02:00
Vadim Zeitlin
5e3ba81bbf Revert accidentally committed wxGrid changes
These changes were included in 18e05aeeee
accidentally, revert them for now (they will be recommitted later with a
proper commit message).

See https://github.com/wxWidgets/wxWidgets/pull/1601
2019-10-12 16:08:24 +02:00
Olly Betts
18e05aeeee Remove no-op uses of wxNO_FULL_REPAINT_ON_RESIZE
This behaviour has been the default and this constant 0 since
e441e1f4e8 which was over 16 years ago.

Closes https://github.com/wxWidgets/wxWidgets/pull/1601
2019-10-11 14:12:43 +02:00
Artur Wieczorek
07e9b82925 Add option to select pen style in graphics benchmarks
Since the performance of drawing lines with various pen styles can be the subject of examination it would be good to have the ability to select pen style with a command line option.
So, a new option "pen-style" is supported since now and with this new option "solid", "dot", "long_dash", "short_dash" styles can be explicitly selected.
2019-10-10 19:45:47 +02:00
Artur Wieczorek
7596bd41c2 Add benchmark of drawing cross hair
There is a special API to draw cross hair so it would be good have ability to test its performance.
2019-10-10 19:42:33 +02:00
Vadim Zeitlin
cc7c0bbd9c Merge branch 'msw-richedit-paste'
Fix pasting long strings into wxTextCtrl in wxMSW.
2019-10-10 13:56:00 +02:00
Ilya Sinitsyn
85b37bea49 Fix GetBestSize() for hidden controls in wxGTK
gtk_widget_get_preferred_size() return zero size if the GTK widget is
hidden, so show it temporarily in order to find its real preferred size.

Add a unit test checking that the best size of a hidden wxChoice is now
determined correctly.

Closes https://github.com/wxWidgets/wxWidgets/pull/1587
2019-10-09 14:56:49 +02:00
Vadim Zeitlin
efc2a9da2d Fix pasting long strings in wxTextCtrl under MSW
Adjust the length limit before pasting to ensure that all text on
clipboard will be successfully pasted, instead of only pasting the part
of it which fits.

Add a unit test checking that this works.

Closes #4646.
2019-10-09 14:40:53 +02:00
Vadim Zeitlin
c92f9e0a17 Document that wxDateTime::UNow() returns time in local time zone
This is its actual behaviour and it's the right thing to do, as it's
consistent with Now() -- even though the documentation wrongly stated
otherwise (since 324ab5e2db).

Also add a unit test checking that UNow() == Now(), except for the
milliseconds.

See #14148.

Closes #18524.

Closes https://github.com/wxWidgets/wxWidgets/pull/1594
2019-10-07 12:27:28 +02:00
Vadim Zeitlin
86fab39ac9 Regenerate MinGW makefiles using response files
This avoids errors due to overflowing MSW command line length when
linking monolithic library.

Closes #18135.
2019-10-06 23:04:21 +02:00
Vadim Zeitlin
e677bf7bcd Fix harmless signed/unsigned comparison warnings in menu test
Make the loop variable unsigned as it's compared with the result of
WXSIZEOF().
2019-10-06 17:43:08 +02:00
Artur Wieczorek
80d0496689 Add benchmarks of drawing horizontal and vertical lines
Drawing horizontal and vertical lines may be done in a specific (optimized) way so it would be good to have separate benchmarks for such operations.
2019-10-05 20:43:34 +02:00
Vadim Zeitlin
51adb388a4 Merge branch 'dc-clear-white-default'
Fix regression in wxDC::Clear() and make wxGCDC::Clear() consistent with
it by using white if the background brush hadn't been explicitly set.

See https://github.com/wxWidgets/wxWidgets/pull/1582
2019-10-05 18:47:44 +02:00
Vadim Zeitlin
73cab0bd4e Keep children of collapsed item selected in wxGenericTreeCtrl
Collapsing a branch shouldn't deselect all the items under it in
multi-selection mode: this doesn't seem to be useful or otherwise make
sense and makes the generic version gratuitously incompatible with the
native MSW one.

Closes #10239.

Closes https://github.com/wxWidgets/wxWidgets/pull/1581
2019-10-05 15:03:20 +02:00
Vadim Zeitlin
239f045a3f Merge branch 'textctrl-override-accels'
Allow using Ctrl-A without overriding its function in wxTextCtrl under
MSW.

See https://github.com/wxWidgets/wxWidgets/pull/1577
2019-10-05 15:02:28 +02:00
Artur Wieczorek
2366c7ba1f Add benchmarks of drawing bitmaps with masks 2019-10-03 22:31:20 +02:00
Vadim Zeitlin
cf07dea50d Add unit tests for wxDC::Clear()
Verify that it behaves as documented, i.e. uses white if the background
brush is not explicitly set.
2019-10-02 02:45:28 +02:00
Vadim Zeitlin
8db55e9653 Explicitly cast enum to int inside CHECK()
Somehow using enum results in wrong comparison being done when using gcc
5.3 (the test run when using this compiler fails because the RHS value
is "true" and not the numeric value of the enum element), so add a cast
to make this work.
2019-09-30 11:29:33 +02:00
Vadim Zeitlin
0aaa05ae3a Override Ctrl-A accelerator when wxTextCtrl has focus in wxMSW
This key combination is used for selecting all text, while it's also
relatively common to use it as an accelerator for some menu item.

Resolve the conflict in favour of wxTextCtrl, i.e. let it have this key
when it has focus, while still allowing to use it as an accelerator
otherwise.
2019-09-30 00:20:06 +02:00
Vadim Zeitlin
bd5b3725b9 Simplify menu items counting code in the unit test
Get rid of an extra variable and just update m_itemCount on the go.

No real changes, but this'll make adding more test menu items simpler.
2019-09-30 00:20:06 +02:00
Vadim Zeitlin
758bd6fa6e Create test frame in menu test in more predetermined position
Create this frame as child of the main application window to make it
appear near it, instead of in a more or less random location. This
facilitates debugging, but doesn't really change anything otherwise.
2019-09-30 00:20:06 +02:00
Artur Wieczorek
96cb3b6714 Add tests of retrieving sub-bitmaps 2019-09-29 16:16:55 +02:00
Vadim Zeitlin
e46385e964 Test that adding window to 2 sizers results in an assert
Check that adding a window to either the same, or different, sizer the
second time asserts -- but that it can still be moved to another sizer
if it is detached from the first one first.

Also document that SetContainingSizer() should never be called from
outside the library.

See #17166.
2019-09-28 23:42:37 +02:00
Vadim Zeitlin
7bba2d09fd Merge branch 'drop-cppunit-window-test'
Get rid of CppUnit compatibility macros in wxWindow unit tests.

See https://github.com/wxWidgets/wxWidgets/pull/1568
2019-09-28 23:42:37 +02:00
Vadim Zeitlin
04949050b2 Merge branch 'qt-fixes'
A multitude of miscellaneous Qt fixes and improvements.

See https://github.com/wxWidgets/wxWidgets/pull/1552
2019-09-27 19:18:11 +02:00
Vadim Zeitlin
7be12edc7a Replace legacy CppUnit macros with CATCH ones
Still no real changes, just use Catch macros directly instead of doing
it via CppUnit-compatible shims.
2019-09-27 15:58:09 +02:00
Vadim Zeitlin
b176b59ffe Get rid of legacy CppUnit test case machinery in wxWindow test
No real changes, just remove the CPPUNIT_TEST[_SUITE] ugliness.
2019-09-27 15:55:18 +02:00
Vadim Zeitlin
9a0072b12e Remove wxDECLARE_NO_COPY_CLASS from a local class in wxGrid test
Declaring the copy ctor/assignment operator for a local class without
defining them triggers MSVC warning C4822, so don't do this to avoid
unnecessary noise in the build logs (we could disable the warning or
conditionally do this for non-MSVC compilers, but it doesn't seem to be
worth doing this for a class used inside a single function and very
unlikely to be copied accidentally).
2019-09-26 22:23:36 +02:00
Vadim Zeitlin
35de675830 Extract waiting for the first paint event in a reusable function
No real changes, this is just a refactoring to allow reusing the same
loop waiting until we can get the real window geometry in other tests.

This commit is best viewed with --color-moved.
2019-09-22 00:56:23 +02:00
Vadim Zeitlin
da8cecbfe5 Add a unit test checking that Move() doesn't change frame size
This used to be broken in wxQt until it was fixed by the previous
commit.

See https://github.com/swig/swig/pull/1613
2019-09-22 00:50:32 +02:00
Vadim Zeitlin
baca938ce3 Rewrite SetSizeTestCase to not use CppUnit macros neither
Do the same thing as in the previous commit to another test.

No real changes.
2019-09-22 00:50:32 +02:00
Vadim Zeitlin
3a4538a18c Rewrite client size unit test without using CppUnit macros
No real changes, just simplify the test.
2019-09-22 00:50:23 +02:00
Artur Wieczorek
de5f8c69e5 Fix build with wxUSE_LIBTIFF==0 2019-09-19 00:39:59 +02:00
Artur Wieczorek
7f65e654ee Add tests of drawing wxBitmap 2019-09-19 00:38:30 +02:00
Artur Wieczorek
5aac5ae562 Migrate wxBitmap tests to Catch 2019-09-19 00:37:48 +02:00
Vadim Zeitlin
fcd734387a Fix best size computation for multiline wxTextCtrl in wxGTK
The initial value was not taken into account before because the best
size computed before it was set, i.e. for the empty control, was always
used, as it was never invalidated.

Do invalidate it now if the control is created with non-empty value, in
order to adjust its best, and initial, size appropriately to its
contents.

Closes #18507.

Closes https://github.com/wxWidgets/wxWidgets/pull/1560
2019-09-18 14:35:12 +02:00
Vadim Zeitlin
93815ad2d2 Merge branch 'listctrl-itemrect'
Improve wxListCtrl::GetSubItemRect() and add a unit test for it.

See https://github.com/wxWidgets/wxWidgets/pull/1511
2019-09-14 16:37:57 +02:00
Ilya Sinitsyn
dda6aa6bdc Fix assert with setting current cell in wxGrid::Redimension()
Avoid calling wxGrid::SetCurrentCell(0, 0) when the grid has no columns
or rows, as it doesn't have any cells then and doing this logically
fails the precondition assert in GetColPos().

Also refactor all 6 different snippets calling SetCurrentCell() in
Redimension() into a single function to simplify the code and make it
more maintainable.

Add a unit test verifying that this works as intended.

Closes https://github.com/wxWidgets/wxWidgets/pull/1546
2019-09-13 00:47:48 +02:00
Vadim Zeitlin
c1fdc717ae Merge branch 'multiline-enter-fix'
Fix handling Enter in multiline text controls in wxMSW.

And other improvements, notably don't send wxEVT_TEXT_ENTER for controls
without wxTE_PROCESS_ENTER style.

Closes #18491.

See https://github.com/wxWidgets/wxWidgets/pull/1539
2019-09-12 00:50:00 +02:00
Artur Wieczorek
163c7cf834 Fix checking WXUSINGDLL in conditional block
We have to check if WXUSINGDLL macro is defined instead of checking its value.
2019-09-10 22:52:23 +02:00
Ilya Sinitsyn
e2bd6ec8f7 Fix clearing selection in a grid with reordered columns
Since the changes of 04f7f1fd32 (frozen
rows/columns implementation), RefreshBlock() could call GetColPos() with
an invalid index. This didn't matter most of the time as the function
simply returned the same index as long as the columns were using their
natural order, but resulted in a crash due to an out of bound access to
m_colAt array as soon as they were reordered.

Fix this by avoiding using invalid indices in RefreshBlock() and, more
generally, improving its precondition check and making the assumptions
about the input parameters more clear. Also add a defensive check to
GetColPos() itself.

Finally, add a unit test exercising this code.

Closes https://github.com/wxWidgets/wxWidgets/pull/1536
2019-09-10 19:41:45 +02:00
Vadim Zeitlin
9bab9d8da8 Don't activate default button on Enter in multiline wxTextCtrl
Restore behaviour until c43e0fa123 and let
Enter presses in multiline text controls perform their default function
in the control instead of closing the dialog.

Make the unit test more discerning to check for this.
2019-09-10 18:48:20 +02:00
Vadim Zeitlin
84f29ce472 Don't send EVT_TEXT_ENTER to controls without wxTE_PROCESS_ENTER
wxMSW always sent this event to multiline text controls, even when they
didn't have wxTE_PROCESS_ENTER style, contrary to what was documented.

Avoid sending this event unless wxTE_PROCESS_ENTER is used and add unit
tests checking that multiline text controls don't get it without this
style (but still do get it with it).
2019-09-10 18:48:20 +02:00
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