Also simplify/streamline wxStopWatch implementation and replace confusingly
named m_pause with more clear m_elapsedBeforePause.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69835 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Make wxStopWatchTestCase::Misc() run in 2.5 seconds instead of 7. This not
only makes the test run faster but allows us to test wxMilliSleep() and
precision of wxStopWatch for time periods in fractional seconds.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69833 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Document which wxRegion methods can and can't be used when the region itself
is invalid.
Apply the minor changes to wxGTK (Xor() didn't do the right thing, Offset()
didn't assert) and wxOSX (Offset() crashed) to make their behaviour consistent
with wxMSW.
Add a (trivial, so far, but to be extended later) wxRegion unit test checking
that the methods do indeed behave as documented.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69461 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This is a facade for wxDataViewCtrl allowing to easily work with multi-column
trees, possibly with an optional checkbox in the first column. Its API is very
similar to wxTreeListCtrl and it provides a simple migration path from the
latter.
Add the class itself, documentation for it and minimal unit tests.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68916 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Having wxBITMAP_TYPE_TIFF and wxBITMAP_TYPE_TIFF_RESOURCE is more consistent with already using the complete short name of an image format elsewhere (e.g. wxBITMAP_TYPE_JPEG, not wxBTMAP_TYPE_JPG, and wxTIFFHandler as opposed to wxTIFHandler). Renamed all existing occurrences and kept the old enum values for backwards compatibility.
Also renamed occurrences of wxBITMAP_TYPE_RESOURCE to the already existing wxBITMAP_TYPE_BMP_RESOURCE.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68859 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
wxDataViewCtrl::GetSelection() now always returns invalid item if more than
a single item is selected in a multi-selection control.
Also add HasSelection() and GetSelectedItemsCount() to allow checking if any
items are selected.
Updated the documentation, all ports and added a test for all these functions.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68844 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
CPPUNIT_ASSERT_EQUAL() gives more informative error messages in case of
failure which is important when running tests unattended on build slaves.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68843 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
IsEmpty() didn't exist in all ports (notably not wxMSW) and its meaning was
unclear anyhow, so remove it even from the ports where it did exist and add
clear Is{List,Text}Empty() replacements instead.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68808 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The recently added BMP images in tests/image/ were not being copied. Added them to test.bkl and regenerated makefiles.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68791 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Added option wxIMAGE_OPTION_TIFF_PHOTOMETRIC for reading and writing TIFF images. This is mostly for being able to distinguish between PHOTOMETRIC_MINISBLACK (chocolate flavour) and PHOTOMETRIC_MINISWHITE (vanilla) as currently the flavour used was fixed. It applies to greyscale as well as black and white images. Added unit tests to verify the written photometric value.
Also see #13194.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68785 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
When saving with a samples per pixel value of 1 the TIFF handler still treated the image as RGB, resulting in corrupted images. Handle the greyscale case and added a unit test for it.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68784 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
When setting only wxIMAGE_OPTION_TIFF_BITSPERSAMPLE to 1 the used samples per pixel (wxIMAGE_OPTION_TIFF_SAMPLESPERPIXEL) would still be set to 3. This is invalid and confuses libtiff, resulting in a crash ("possible heap corruption" during _TIFFfree using WinXP+MSVC8). Set the used samples per pixel to 1 explicitly in cases where only bits per sample is set to 1. Added a unit test to check for this problem (and verify the bits per sample from the saved image is indeed 1).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68782 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Libtiff attempts to seek past the end of a stream and the behaviour for this can vary per stream implementation. Fixed failure to seek by filling the gap between the end of stream and new seek position with zeroes. Enabled a unit test which so far was disabled due to wxMemoryOutputStream failing to save a TIFF because of the seeking problem.
Also closes#4089.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68772 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The BMP decoder did not handle images that are not stored upside down but straight up (in which case the height is negative). Also with RLE4 or RLE8 compressed images the 'end of scanline' RLE marker was not handled correctly. Fixed the issues and added a unit test for them.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68766 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
First, enable execution of the Lines() wxTextCtrl unit test case under wxOSX
as it passes since the fix in the previous commit.
Do add a test for GetNumberOfLines() that currently doesn't work in the same
way under all platforms -- but with this test we at least can be sure how does
it work exactly where.
Also mention the current discrepancy in this function behaviour in the
documentation.
See #12366.
Fix Lines() wxTextCtrl unit test to pass under wxGTK too.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68465 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Negated long options were not recognized in wxCmdLineParser::Parse(), do check
for them now.
Also extend the unit test to check for negated options.
Closes#13335.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68316 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The internally stored date value was getting out of sync with the real date in
the control itself when SetValue() was called with a date out of the currently
set range. This resulted in an assert failure and other unpleasantness later.
Fix the bug and add a unit test checking for it (and also with some other
basic wxDatePickerCtrl checks).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67990 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
No real changes, just refactor the code to allow using CPPUNIT_ASSERT_EQUAL
with wxDateTime in other tests in the future.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67989 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Allow passing wxLongLong objects when a "%lld" format specifier (or
equivalent) is used just as we already do for wxString objects when "%s" is
used. This is more convenient and makes wxLongLong closes to the native type.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67760 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
wxMSW could return negative client size for tiny windows with borders, this
was unexpected and shouldn't happen so explicitly ensure it does not.
Also add a unit test to check that this problem doesn't exist in other ports.
Closes#13184.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67754 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Don't define the class overriding a virtual base class method inside the test
function as g++ 4.0 under OS X 10.5 fails to compile this for some mysterious
reason.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67722 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Previously the radio menu items could only be appended to a menu in wxMSW,
inserting them (either in an existing radio group or to start a new one) not
only didn't work but could even result in crashes because invalid iterators in
the menu items list could be used.
Fix this by storing the ranges of all radio groups in wxMenu itself instead of
storing the information about the radio group an item belongs to in the item
itself and by updating this data whenever a new radio item is inserted. Also
get rid of the notion of "current radio group" in wxMenu which doesn't really
make any sense.
Finally add a unit test checking that inserting radio items works as expected.
Closes#13200.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67720 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Removing the path watched by wxFileSystemWatcher didn't do anything in wxMSW
implementation so we still continued getting events for the changes to this
path even after calling Remove().
Fix this by really implementing Remove() properly. Also add a unit test
checking that we don't get any events after calling Remove().
See #12847.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67691 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
CheckResult() method of the test event handler doesn't need to return
anything, it uses CPPUNIT_ASSERTs and related macros inside it to check that
everything is expected.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67690 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Additionally renamed wxOSX' private wxNativePrinterDC::Ok() function to IsOk().
Didn't deprecate the various Ok() functions: given the amount of changes already introduced in 3.0 a trivial one like this seems more suitable for after 3.0.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67681 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Added toplevel.cpp to GUI test projects and removed the test suite from the unnamed registry so that by default its tests don't run (some regarding ShowWithoutActivating are failing). This way at least the source file has more of a chance to be in a compilable state (compilation was broken). toplevel.cpp has never been included in a project since its addition in r62508 ("[...] until the mainloop issues are resolved [...]").
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67657 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
VC6 doesn't specialize numeric_limits<> for its __int64 so it's not
specialized for wxLongLong neither when using this compiler.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67633 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Instead of forcing the tests to manually use memcmp(), specialize
CppUnit::assertion_traits<> for wxImage. This allows to simply use
CPPUNIT_ASSERT_EQUAL() and related macros with wxImage objects.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67616 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Verify that this function (which is used for parsing the wildcard strings used
with file-related dialogs) works as expected and also asserts when given
invalid input.
See #4489.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67585 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Support for wxXML_PI_NODE introduced in r67346 broke SetRoot() and, because of
this, saving XML documents.
Correct this and add a unit test for this method.
Closes#13135.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67519 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Adding items to wxSortedArrayString should always keep them sorted but while
Add() did this, push_back() didn't breaking the class invariant.
Redefine push_back() in _WX_DEFINE_SORTED_TYPEARRAY_2 macro to fix this and
add a unit test checking that wxSortedArrayString::push_back() does work now.
Closes#13134.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67429 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The changes in r67345 changed CheckXml() vararg function to take a reference
as the first argument but this doesn't work with va_start(), so revert to
using a pointer here.
This fixes the current unit test failures in the XML tests.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67408 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
In non-wxHAS_XLOCALE_SUPPORT case we didn't restore the original locale
correctly in wxStrtoxxx_l() functions as the return value of wxSetlocale() was
incorrectly assumed to be the old locale instead of the new one.
Fix this and also replace the macros used by the old code with a small helper
class, this simplifies the code and is less ugly.
Finally add a unit test which failed before these changes when the program ran
in any non-C locale but passes now.
Closes#13117.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67406 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The return value of setlocale() was used incorrectly in this code: it
represents the newly set locale and not the previously active one so we didn't
actually restore the original locale before.
Fix the code and check that we do actually restore the locale in a new unit
test for it.
See #13117.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67405 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
When type traits are unavailable we can't check whether a type can be passed
to a vararg function but we still need to pass a copyable object to
wxString::Format() for the code to compile, even if we just want to check that
it will fail with the assert at run-time.
Closes#13118.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67398 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Use "wxWindows licence" and not "wxWidgets licence" and also use British spelling for licence. Updated new occurrences in recently added files and a couple of previously (r64940) missed ones.
See #12165.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67387 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
ImageTestCase::DibPadding was always failing due to differences in pixel data between the decoded GIF and encoded ICO image. Instead of comparing image content just check if the saving of the ICO succeeds (prior to r67296 it would crash).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67386 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Use locale-independent functions to parse and generate the floating point
alpha representation in CSS syntax for colours to make it work in locales
which don't use period as decimal separator.
Closes#13077.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67356 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This is mainly useful for parsing and generating processing instructions but
can be used for any kind of elements, e.g. also comments, occurring before the
document node in XML documents.
Closes#11593.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67346 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
When an image did not have a width with a multiple of 4 the calculations for the number of padding bytes (to get a scan line DWORD aligned) would be wrong. This caused a buffer overrun when saving the 1 bits per pixel mask.
Fixes#12937.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67296 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Applied patch by snowleopard2 fixing a bunch of typos such as misspellings and double words in the documentation. Combined the patch with some local queued typos waiting to be committed as well as adding new typo fixes inspired by the patch.
Function names with American spelling were not changed nor was third-party code touched. The only code changes involve some changes in strings that are translated ("Can not" -> "Cannot").
Closes#13063 (again).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67280 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Optionally support fixed precision in wxString::FromDouble() and FromCDouble()
methods. This is mostly useful for the latter to be able to format numbers in
portable way (using dot as decimal separator) without loss of precision but
also do it for the former for consistency.
Closes#12973.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67181 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Instead of converting alpha to a mask an attempt is made to write a palettised PNG file with an ARGB palette using a maximum of 256 transparency values where formerly just up to one was supported. GIF images with 256 colours and transparency can now also be saved as a palettised PNG instead of true colour, making the image a lot smaller.
Applied (modified) patch by troelsk. Closes#12850.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67101 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
VC6 seems to have a strange bug with escaped quotes used in strings passed to
macros and failed to compile the original code with nonsensical error messages.
Use single quotes to try to work around this issue. They are also somewhat
more readable as they don't need to be escaped inside C strings.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67077 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This is an incompatible change which removes the wxStaticText-specific
wxST_MARKUP style and adds wxControl::SetLabelMarkup() replacing it.
It doesn't actually change anything yet but it simplifies wxStaticText code a
lot by getting rid of many markup-related functions in it which had to behave
differently depending on whether wxST_MARKUP was used or not and also paves
way for adding markup support for the other controls in the future.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67055 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This code is not used anywhere yet, this commit only adds the parser for the
markup and the related classes as well as the corresponding unit test.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This test consistently fails on the MSW build slave machines (see e.g.
http://buildbot.tt-solutions.com/wx/builders/XPSP2 VC9 wxMSW trunk release/builds/2084/steps/test/logs/stdio)
for unknown reason so disable it for them. Notice that it does pass when ran
locally so it looks like another instance of a problem with wxUIActionSimulator
on these machines rather than the problem with the class itself.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67046 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The mouse was not positioned over the URL in this test so clicking it didn't
work. Tweak the offset to make it pass but it would be better to have some
more fool-proof way of finding the real position of the text in the control.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66866 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Numeric validator tests rely on wxLocale::GetInfo() returning the decimal
point and calling setlocale() is not enough to ensure this under MSW, we must
use wxLocale for this currently.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66865 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
PNG images are used by the main wxWidgets library itself now and so linking
with the monolithic wx library introduces dependencies on PNG as well, even
for the console applications. Link them with linpng to avoid linker errors.
Closes#12889.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66848 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Update configure and bakefile.m4 for the new version too.
Also add the missing makefiles and projects for the XTI sample.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66836 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Applied (modified) patch by troelsk. Changed comments (which are allowed per frame in an animated GIF) to be read using wxIMAGE_OPTION_GIF_COMMENT with wxImage.GetOption. Added unit tests for reading and writing GIF comments.
Closes#12843.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66828 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
There were no boundary checks in place to verify an indicated repeat of pixels would still be inside the image's data. Added these checks and a unit test making sure these kind of TGAs now fail to load.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66758 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Ensure that the tests expecting the results with a point as decimal separator
really are done in C locale.
This should help the tests pass in (French) locale used by the MSW build bot
slaves.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66727 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775