Commit Graph

2536 Commits

Author SHA1 Message Date
Artur Wieczorek
dc43d15cf7 Add tests of storing HiDPI images in generic wxImageList (wxOSX, wxGTK3) 2021-04-05 12:18:05 +02:00
Artur Wieczorek
2ed7355d5c Add wxImageList tests with negative scenarios (invalid sizes, indices) 2021-04-04 20:53:02 +02:00
Vadim Zeitlin
c41357ed22 Skip another test using /proc and /sys when using LXC
This should have been part of the previous commit.
2021-04-04 15:35:46 +02:00
Vadim Zeitlin
051fa788ad Skip all tests using /proc and /sys in LXC containers
These tests fail in S/390 Travis CI build, so just don't run them at all
there, as we already did for a couple of tests using /proc that also
failed in other LXC-based builds.
2021-04-04 15:07:29 +02:00
Vadim Zeitlin
85b944d164 Merge branch 'webrequest-keep-alive'
Ensure that wxWebRequest objects stay alive as long as the request is in
progress.

See https://github.com/wxWidgets/wxWidgets/pull/2292
2021-03-25 14:04:24 +01:00
Vadim Zeitlin
360268ee25 Extend life time of wxWebRequest while it is in process
We already did it just before processing the state change event, but
this was too late, as the object could have been already deleted by then
and this actually happened with the example from wxWebRequest
documentation.

Do it earlier now, as soon as the request becomes active, which normally
happens when Start() is called, and keep the reference until the event
is processed after the request reaches one of the final states
(completed, failed or cancelled).

Add a unit test checking that deleting the wxWebRequest object doesn't
prevent the request from running to the completion any more.
2021-03-24 17:45:01 +01:00
Vadim Zeitlin
0548a06905 Check the values from wxWebRequestEvent in the unit test too
In addition to checking that wxWebRequest itself is filled with the
expected values, verify that the same values are returned via
wxWebRequestEvent.
2021-03-24 16:33:05 +01:00
Vadim Zeitlin
9e96ff972b Fix wxXmlResource::Load() with HTTP URLs
Make the code in this function work even with wxFileSystemHandlers that
don't implement FindFirst() at all: we can, and should, still try
loading the passed in path with them, rather than not doing anything at
all.

This makes Load() works with HTTP URLs again, as it apparently used to
do a long time ago, but didn't do any more.

Add a unit test, even if only a semi-manual one, to try to help with
this not getting broken again (ideal would be to launch our own HTTP
server inside the test, but this is a bit more complicated).

Closes #19109.
2021-03-23 13:43:20 +01:00
Vadim Zeitlin
71eff92873 Remove CppUnit boilerplate from XRC unit test
No real changes, just simplify by using CATCH macros and a simple
fixture instead of CppUnit::TestCase.
2021-03-22 15:31:51 +01:00
Paul Cornett
c82e13068a Fix comment typo 2021-03-17 10:30:34 -07:00
Paul Cornett
5154780bbf Avoid some -Wcast-qual warnings 2021-03-17 10:16:32 -07:00
Vadim Zeitlin
5e1f7beafe Merge branch 'regex-tests'
Fix regex-related tests to actually run as part of the test suite again.

See https://github.com/wxWidgets/wxWidgets/pull/2279
2021-03-14 13:10:14 +01:00
Vadim Zeitlin
89d1ec631b Make built-in regex library tests run again too
These tests were also broken by transition to CATCH and didn't run any
longer.

Fix this by replacing CppUnit test suite objects with CATCH test cases
and using a simple helper CheckRE() function instead of creating
complicated test objects hierarchies.
2021-03-14 13:10:14 +01:00
Vadim Zeitlin
7d46755124 Make wxRegEx unit tests actually run again
These tests didn't run at all since the changes of e70fc11ef1 (Replace
CppUnit with Catch for unit tests, 2017-11-01) that removed CppUnit:
while they still compiled, the required suite functions were not called
automatically any longer and so nothing happened during run-time.

Finish really removing CppUnit stuff now and just use simple functions
for the checks: this might not be as elegant, but is much simpler and
more transparent.
2021-03-14 13:10:14 +01:00
Vadim Zeitlin
16495e424d Merge branch 'utf8-std-string'
Add wxString::utf8_string().

See https://github.com/wxWidgets/wxWidgets/pull/2265
2021-03-14 13:10:13 +01:00
Vadim Zeitlin
e667071416 Compile wxConfig unit tests as part of non-GUI test too
Almost none of the tests require GUI, so make it possible to run them
without it, but still include the GUI tests when using GUI.
2021-03-13 15:15:40 +01:00
Vadim Zeitlin
0c837e5310 Add support for size_t to wxConfig
Allow writing and reading size_t values directly too, there were not
previously accepted unlike all the other arithmetic types.

Closes #19091.
2021-03-13 15:15:37 +01:00
Vadim Zeitlin
fce8780297 Add 64-bit integers support to wxConfig
Serialize them to strings in wxFileConfig, just as we always did for
long, but use wxRegKey support for storing them directly to the registry
in wxRegConfig.
2021-03-13 15:14:58 +01:00
Vadim Zeitlin
eb33447c39 Use template function to avoid code duplication in wxRegConfig
Don't repeat exactly the same code for 3 different types, just use a
template function instead.

Change the existing TryGetValue() helpers to take all output parameters
consistently by pointer, rather than taking only long by pointer and the
other by reference. This allows to isolate the inconsistency of the type
of wxRegKey::QueryValue() parameter in a single place here, hiding it
from the rest of wxRegConfig code.

Add an extra unit test for writing/reading longs to/from wxRegConfig.
2021-03-09 19:15:03 +01:00
Vadim Zeitlin
62cfa638c0 Remove wxT() from wxConfig unit tests
Just remove the visual noise, no real changes.
2021-03-09 19:15:03 +01:00
Vadim Zeitlin
2e6bb341b7 Use smart pointer instead of manual delete in wxConfig tests
No real changes.
2021-03-09 19:15:03 +01:00
Vadim Zeitlin
f5f2db8b44 Get rid of CppUnit boilerplate in wxConfig unit tests
No real changes.
2021-03-09 19:15:03 +01:00
Vadim Zeitlin
5ddf57c150 Add wxModule::AreInitialized()
This internal function will be useful to check if the modules are
already initialized, i.e. if the library is in the "steady state"
between the end of the initialization and the beginning of the cleanup
phases.
2021-03-07 20:39:09 +01:00
Vadim Zeitlin
fbd23270e3 Remove CppUnit boilerplate from wxModule unit test
Also use wxString instead of fixed size char array and wxStrcat().
2021-03-07 20:39:09 +01:00
Vadim Zeitlin
0f8e976ac3 Add wxString::utf8_string()
This adds a yet another conversion function, which is not ideal, but
still better than having to write ToStdString(wxConvUTF8) every time for
losslessly converting wxString to std::string: not only this is too
long, but it's also too easy to forget to specify wxConvUTF8, resulting
in data loss when using non-UTF-8 locale.
2021-03-06 15:12:07 +01:00
Vadim Zeitlin
0aacc6a9ab Remove CppUnit boilerplate in std::string interoperability tests
No real changes, just don't use compatibility macros and remove the
completely useless test case.
2021-03-06 15:05:23 +01:00
Vadim Zeitlin
8d01aaf783 Make WebRequest::Get::Param unit test more forgiving
The simple test added in 59a8f26b01 (Add a unit test for wxWebRequest
query using URL parameters, 2021-03-06) worked when using httpbin.org,
but not when running httpbin locally, as it doesn't pretty-print JSON by
default.

Skip optional whitespace to make it work in both cases.
2021-03-06 14:44:56 +01:00
Vadim Zeitlin
26635c2718 Merge branch 'webrequest-fix-param'
Fix URL parameters handling in WinHTTP wxWebView backend.

See https://github.com/wxWidgets/wxWidgets/pull/2264
2021-03-06 12:16:26 +01:00
Vadim Zeitlin
59a8f26b01 Add a unit test for wxWebRequest query using URL parameters
Check that passing URL parameters in the query string works as expected
(this was broken with WinHTTP backend until the parent commit).
2021-03-06 12:11:59 +01:00
Vadim Zeitlin
7bcac7bfde Merge branch 'unix-default-locale'
Improve handling of default locale and other locale-related fixes.

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

Closes #11594.
2021-03-05 18:48:30 +01:00
PB
9d0aee5ee6 Fix using invalid string index in wxIsAbsolutePath()
Check if the path is at least two characters long before accessing its
second character.

Add test cases for wxIsAbsolutePath() on MS Windows.

Closes https://github.com/wxWidgets/wxWidgets/pull/2262
2021-03-02 16:00:59 +01:00
Vadim Zeitlin
b8f63fc7c5 Skip wxLocale wxLANGUAGE_DEFAULT test in ANSI builds
The test fails there, but we don't really care about it, Unicode is
required for any level of acceptable locale support anyhow.
2021-03-01 00:22:39 +01:00
Vadim Zeitlin
5fd85d422f Add a trivial test for setting default locale
Initializing wxLocale using wxLANGUAGE_DEFAULT should work, unless
LC_ALL is explicitly set to an invalid value.
2021-02-28 01:07:47 +01:00
Vadim Zeitlin
b113635111 Use CHECK() instead of CPPUNIT_ASSERT_XXX in arrays tests
This could be further improved by defining array matchers instead of
using the macros, but for now just get rid of the last traces of CppUnit
in this file.

No real changes.
2021-02-26 16:36:10 +01:00
Vadim Zeitlin
eb3fdfe82f Get rid of ArraysTestCase class in the dyn arrays unit tests
Just remove more CppUnit boilerplate, no real changes.
2021-02-26 16:32:45 +01:00
Pavel Tyunin
2451f8085b Fix search in wxSortedArrayString with custom compare function 2021-02-25 21:28:32 +02:00
ali kettab
2689040769 Remove unnecessary hack from ListBaseTestCase under wxGTK
The tests pass without it now, so simplify the test code added in
fedc80eee3 (Improve selection and focus events generation in
wxGenericLisCtrl, 2020-09-06).

Closes https://github.com/wxWidgets/wxWidgets/pull/2249
2021-02-23 21:54:15 +01:00
Vadim Zeitlin
2c9f6770a5 Merge branch 'valnum-unsigned'
Fix handling of unsigned types in numeric validators: don't accept
negative numbers as unsigned, allow using the full 64-bit range.

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

Closes #12967.
2021-02-23 21:52:27 +01:00
Vadim Zeitlin
4cd2cb0acd Merge branch 'win-val-self' of https://github.com/AliKet/wxWidgets
Make wxWindow::TransferData{To,From}Window and Validate work on the
window itself too.

See https://github.com/wxWidgets/wxWidgets/pull/2235
2021-02-23 21:48:16 +01:00
ali kettab
ec20753685 Add tests showing transferring data (to, from) self (window) works correctly 2021-02-22 14:31:20 +01:00
Vadim Zeitlin
72a24b402b Fix deleting of wxTextCtrl in wxNumValidator test case
This was broken in da973c3caf (Get rid of CppUnit boilerplate in numeric
validator unit tests, 2021-02-21) which replaced DestroyChildren() in
the old CppUnit test case dtor with just "delete m_text", as this didn't
take care of "text2" created in one of the tests.

Using DestroyChildren() still seems overly side, so ensure that "text2"
is destroyed explicitly.
2021-02-22 14:26:23 +01:00
Vadim Zeitlin
bdaca38904 Fix transferring unsigned values to the window too
In addition to not accepting "-1" as a valid unsigned value, we also
must not format unsigned values as signed ones, i.e. we need to use
wxNumberFormatter::ToString() overload taking unsigned for them.

Do it in wxIntegerValidatorBase::ToString(), used by TransferToWindow(),
and add more tests for the latter.

Also reorganize the tests in sections and use REQUIRE() for the checks
that should prevent the rest of the section from running if they fail.
2021-02-22 12:58:14 +01:00
Vadim Zeitlin
94289a46b1 Relax check for converting "-" to long long in the unit tests
This somehow succeeds when using gcc 4.8 under Ubuntu 14.04 or MinGW
5.3, so don't fail the tests in this case, but still warn about it
because it seems quite unexpected.
2021-02-22 12:57:58 +01:00
Vadim Zeitlin
a91cb5c344 Use CHECK_FALSE in wxNumberFormatter unit tests
Just replace CHECK(!condition) with CHECK_FALSE(condition), this should
result in slightly more clear error messages.

Also make tests for long and long long more consistent.
2021-02-22 11:55:32 +01:00
Vadim Zeitlin
cddc657505 Use min/max values of correct type in numeric validators
Use the actual type of the value, not LongestValueType, for storing
m_min and m_max as this is necessary for the comparisons between the
value and them to work correctly for unsigned types.

Also check for precision loss when converting from the bigger
LongestValueType to the actual type.

Add new unit tests, that failed before, but pass now.
2021-02-22 11:49:19 +01:00
Vadim Zeitlin
eb64202ad4 Add support for unsigned long long to wxNumberFormatter
This is necessary in order to deal with the numbers greater than
wxINT64_MAX that can't be represented in just long long.

It also allows to implement the intuitive handling of minus sign for the
unsigned numbers, i.e. not to accept it in FromString(), unlike the
standard functions which do (and parse -1 as 0xffff...fff).

Also extend the tests to check for more boundary cases.
2021-02-22 11:49:19 +01:00
Vadim Zeitlin
d8113b36c3 Merge branch '12764-faster-grid-attr-lookup' of https://github.com/discnl/wxWidgets
Improve responsiveness of a wxGrid with many attributes by using hash
map instead of array for storing them and looking them up.

See https://github.com/wxWidgets/wxWidgets/pull/2229
2021-02-22 00:21:31 +01:00
Vadim Zeitlin
b53f7ac904 Restore support for using faster dotted pens in wxMSW
Changes of d245dc9e1f (Fix drawing of dotted lines with wxDC in wxMSW,
2020-03-27) improved the appearance of dotted and dashed lines in wxMSW
but at the expense of significant (up to a factor of 300) slowdown.

Allow the applications for which the drawing performance is important to
explicitly request the old behaviour, with uglier, but faster, pens by
choosing to use low quality pens.

Update the graphics benchmark to allow specifying the pen quality and
verify that the performance when using it is the same as before 3.1.4.

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

See #7097.

Closes #18875.
2021-02-22 00:04:07 +01:00
Vadim Zeitlin
959d955a80 Make wxNumberFormatter tests more concise and readable
Define a couple of helper functions to avoid over long lines or having
to break them and also align the tests vertically to allow scanning them
more easily.

No real changes.
2021-02-21 17:13:01 +01:00
Vadim Zeitlin
a015270709 Replace CPPUNIT_ASSERT() macros in wxNumberFormatter unit tests
Just use CHECK() rather than CPPUNIT_ASSERT_EQUAL() etc.
2021-02-21 17:02:55 +01:00