Commit Graph

965 Commits

Author SHA1 Message Date
Vadim Zeitlin
52212bcb4a Yet another fix to event propagation in scrolled windows.
Calling ProcessEventLocally() didn't work because the command events were not
propagated to the parent window any more, breaking a lot of things including
wxDataViewCtrl event generation in the generic version. So do restore
ProcessEvent() call but use it on the next handler (i.e. the window itself)
and not this one now. This still results in some duplicate calls but at least
the events should be passed everywhere where they are expected to arrive.

wxScrollHelperEvtHandler must die.

Closes #12078.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64370 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-05-21 12:07:45 +00:00
Vadim Zeitlin
ce45133ee7 Fix wxScrollHelperEvtHandler broken by recent changes to event processing.
Use ProcessEventLocally() added in r64261 (which was probably the one to break
this) to forward event to the window itself instead of ProcessEvent() in
wxScrollHelperEvtHandler::ProcessEvent() implementation. Calling ProcessEvent()
didn't work any more in a case when another event handler was pushed on a
wxScrolledWindow: in this case the EVT_SIZE and EVT_PAINT handlers defined in
the window itself were not called at all any more.

Add a unit test checking for the even more tortuous than usual event
processing path in this particular case.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64358 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-05-20 17:33:26 +00:00
Francesco Montorsi
45cb70531f remove TestTimer() (adds nothing to existing tests) and move wxStopWatch tests to a new CppUnit test.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64326 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-05-16 15:44:17 +00:00
Francesco Montorsi
210bfffb97 move TestUtf8() and TestEncodingConverter() functions to UnicodeTestCase. Disable some code which does not run clean and mark it with FIXME comments (needs revision).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64324 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-05-16 15:32:41 +00:00
Francesco Montorsi
3dea816bd2 move TestTextInputStream() function in CppUnit's TextStreamTestCase class
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64318 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-05-16 14:31:00 +00:00
Francesco Montorsi
5d029a1d7c fix for non-PCH builds; also use wxMilliSleep instead of wxThread::Sleep since the former is more readable (it's clear that it takes milliseconds).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64285 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-05-11 07:16:58 +00:00
Francesco Montorsi
1f5496a0f5 move code testing wxThread classes from the console sample to a new CppUnit test
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64283 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-05-10 21:48:24 +00:00
Vadim Zeitlin
b6812a6f19 Add column parameter to wxListCtrl::GetItemText().
Allow retrieving the text from columns other than the first one directly.

Add implementations for MSW and generic versions, documentation and a unit
test.

Closes #11597.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64281 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-05-10 21:22:16 +00:00
Jaakko Salli
d517b60699 Modify float/double wxAny testing to use CPPUNIT_ASSERT_EQUAL() instead of CPPUNIT_ASSERT_DOUBLES_EQUAL(), so that we know the retrieved values are truly identical.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64231 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-05-06 17:21:50 +00:00
Vadim Zeitlin
51fe41000c Disable ImageTestCase::LoadFromFile() on build slaves.
This test case keeps failing erratically resulting in too many bogus build
breakage notifications. Disable it until someone has time to fix it properly.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64134 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-24 17:52:27 +00:00
Vadim Zeitlin
5811b24f5e Fix harmless warning about a possibly uninitialized variable.
gcc complained about possibly uninitialized variable in QueueTestCase in
optimized build, just initialize it to suppress this warning.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64112 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-22 14:16:26 +00:00
Jaakko Salli
153107b402 Allow wxAny to contain 'const char*' or 'const wchar_t*'. This was previously not possible since these pointers were converted to wxString, as convenient means to work with string literals. Now pointers (to string literals) are stored instead, and As<wxString>(), comparison operators do the type conversion.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64106 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-22 13:51:38 +00:00
Jaakko Salli
49efebe247 Fix VC6 compilation by changing the order of assignment operators in wxAny
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64059 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-20 12:55:34 +00:00
Jaakko Salli
fdfd64994c Improve wxAny<->wxVariant conversion 64-bit integer tests
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64049 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-19 14:23:49 +00:00
Vadim Zeitlin
b7cb8553f3 Use "monospace" face name for all Unix systems, hopefully it should work.
This fixes failures of several build bot slaves (all running Debian or
Ubuntu) which were due to using "Fixed" under these Linux distributions.

Unfortunately "Fixed" didn't work as Pango doesn't seem to recognize it as a
valid face name. "DejaVu Sans" should probably work on most current Linux
systems but "Monospace" should hopefully be available on other Unix systems as
well.

We could also just take whatever wxFontEnumerator returns which should
probably be even more fool-proof.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64041 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-18 22:15:53 +00:00
Jaakko Salli
0aaed451fd Fix wxAny for VC6 by removing 'wxAny& operator=(const wxVariant &variant)' for it. This will break some cases of implicit wxVariant->wxAny conversion (for VC6).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64022 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-18 11:15:26 +00:00
Jaakko Salli
0bf14ab8b1 wxVariant <-> wxAny conversion functionality. Includes implicit construction of wxAny from wxVariant, and vice versa. wxVariant->wxAny conversion is implemented by adding new virtual member function into wxVariantData. wxAny->wxVariant conversion is implemented by associating wxAnyValueTypes with functions that generate wxVariantData instances (using a hash map).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64000 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-16 14:33:52 +00:00
Václav Slavík
3acf8a8d9b Remove wxLOCALE_CONV_ENCODING flag.
This doesn't affect Unicode builds, only the legacy ANSI one.

PO files are now always converted to the appropriate charset according
to current locale. This was the default behavior for long time; not
doing the conversion was always a fragile hack that didn't work well.
Removing this flag simplifies wxLocale code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63993 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-16 11:29:22 +00:00
Václav Slavík
f30bd8f262 Add wxLOCALE_DONT_LOAD_DEFAULT (=0) for clarity.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63992 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-16 11:29:09 +00:00
Václav Slavík
8d94819c43 Remove wxUSE_WCHAR_T checks.
wxWidgets requires wchar_t for some time now; wx/chartype.h has a check
to fail complation without it. Simplify code by removing now-dead code
for the !wxUSE_WCHAR_T case.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63991 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-16 10:43:18 +00:00
Vadim Zeitlin
7f2468e96a Fix using weak references to incomplete classes.
wxWeakRef can work with forward-declared classes provided dynamic_cast<> is
available but this wasn't detected as being the case due to the use of the
obsolete HAVE_DYNAMIC_CAST in its code.

Replace HAVE_DYNAMIC_CAST with !wxNO_RTTI to fix this.

Also add a unit test checking that this does work.

Closes #11916.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63986 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-15 22:47:37 +00:00
Vadim Zeitlin
deee2b1885 Exclude wxWeakRef tests not compiling with VC6 from compilation.
The ctor used by these tests can't be enabled for VC6 (see r63955), simply
disable them to allow the rest to compile.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63965 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-13 16:38:18 +00:00
Vadim Zeitlin
9def6786d6 Fix string stream unit test compilation in non-Unicode build.
wxScopedCharBuffer can't be constructed from char* string, just use
wxCharBuffer instead, we don't care about efficiency here.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63950 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-12 11:21:37 +00:00
Vadim Zeitlin
8dd13d0fa1 Fix return value of wxList::insert() in non-STL builds.
The returned value was the same as the iterator that was passed in which could
even be invalid when appending.

Fix the wrong use of postfix decrement instead of prefix one and handle the
case of appending correctly.

Closes #11808.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63943 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-12 00:36:36 +00:00
Vadim Zeitlin
e3ab69523b Add wxString::ToStdString() and ToStdWstring().
These trivial helper functions are available in all builds (provided that
wxUSE_STD_STRING is not explicitly set to non-default 0 value) unlike implicit
conversions to std::[w]string which are only available when wxUSE_STL==1.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63938 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-11 11:08:49 +00:00
Vadim Zeitlin
43aecc4dd7 Add non-template wxWeakRef<T> constructor from T*.
We need a non-template ctor to make the code initializing wxWeakRef with
literal NULL to compile.

Closes #11916.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63934 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-10 18:13:29 +00:00
Václav Slavík
b796194b15 Regenerated makefiles after removing USE_GDIPLUS.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63925 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-09 14:14:26 +00:00
Robin Dunn
38723be1d5 Add wxVectorSort function for sorting wxVector<T> containers. Closes #11889
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63904 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-07 20:32:25 +00:00
Vadim Zeitlin
a07526187a Rename the rest of wxSIZE_CONV_TRADIONAL to wxSIZE_CONV_TRADITIONAL.
Fix tests compilation after r63886.

See #10673.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63891 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-07 10:50:41 +00:00
Vadim Zeitlin
58271f42ce Attempt to correct mysterious MSVC6 compilation error.
For some reasons MSVC6 refuses to compile TestData struct initialization. Try
to work around it by not using wxULongLong as this looks like the only thing
which might be confusing it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63874 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-06 17:38:27 +00:00
Vadim Zeitlin
be8332eb97 Fix more harmless warnings.
Fix a warning about unused parameters and another about signed/unsigned
comparison during samples and tests compilation.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63873 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-06 17:38:23 +00:00
Vadim Zeitlin
b2edb8f3c5 Add support for IEC and SI size units to wxFileName::GetHumanReadableSize().
Allow choosing the multiplier to use (1000 or 1024) and the names of the units
(SI or IEC). By default, still use traditional convention, i.e. multiplier of
1024 but SI unit names. This will probably need to be changed to use IEC units
in the future.

Also added unit test for this function.

Closes #10673.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63870 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-06 14:53:04 +00:00
Francesco Montorsi
00e075e551 Committing modified version of jwiesemann's patch (see #11223):
Fix wxURL copy ctor and assignment: the default ones provided by the compiler are wrong because wxURL uses pointers internally. 
Also add a test for copy & assignment in URLTestCase.

Closes #11223

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63806 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-30 21:38:31 +00:00
Vadim Zeitlin
bd9532a416 Add wxBitmap unit test.
This should have been part of r63774.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63778 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-29 09:59:05 +00:00
Vadim Zeitlin
27297c823a Implement wxMask copy ctor for wxGTK.
Without copy ctor copying masks simply crashed because the same pointer was
deleted twice.

Also added a (completely trivial but better than nothing...) unit test for
wxBitmap to check that copying masks does work now.

Closes #11854.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63774 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-28 23:20:49 +00:00
Václav Slavík
b37dacdca6 Fix UTF-8 string storage in constant: use unsigned char.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63765 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-28 17:52:19 +00:00
Václav Slavík
abd5e008f1 Add test wxFileSystem::FileNameToURL,URLToFileName roundtrip with
Unicode filenames.

See #11491.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63762 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-28 15:41:29 +00:00
Vadim Zeitlin
b66a68884d Temporarily disable wxFileSystemWatcher unit test under OS X.
This tests hangs and never finishes, disable it for now to allow buildbot to
at least run the other tests.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63739 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-22 16:08:44 +00:00
Francesco Montorsi
32ee98eb76 reorder GetLabel(), GetLabelText(), SetLabel() and SetLabelText() function declarations, implementations and relative documentations.
Add wxStaticTextBase::GetLabelWithoutMarkup() and use it in the wxMSW implementation of wxStaticText::SetLabel() to close bug #11446; the function RemoveMarkup() which was previously used in fact could not check for presence/absence of wxST_MARKUP style since it's a static function.

Add wxStaticTextBase::SetLabelText() functions for symmetry with wxControlBase::SetLabelText()

Add test unit for both wxControl::*Label* and wxStaticText::*Label* functions.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63733 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-21 21:39:15 +00:00
Vadim Zeitlin
0772a89875 Ensure that setting wxChoice height to its default value does set it.
Setting wxChoice height to its default value didn't change the height even if
the current height was different from the default. This resulted in problems
when a wxChoice was used inside a wxAuiToolBar because AUI temporarily reduces
the toolbar size to (1, 1) when docking it (thus ensuring that the height of
wxChoice is changed too) and generally didn't make sense.

Fix this by resetting the height to the default value if the value passed to
wxChoice::SetSize() is what it considers to be its default height.

Add a unit test for this bug and also add a wxChoice to AUI sample to allow
testing for wxChoice behaviour inside a wxAuiToolBar being [un]docked.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63708 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-18 15:07:39 +00:00
Vadim Zeitlin
729f53d421 Fix box sizer layout algorithm to respect both proportions and min sizes.
The new version of the algorithm tries to distribute the entire space
allocated to the sizer among its children, just as the version in 2.8 did,
while still respecting minimal children sizes first and foremost. This means
that the space allocated to the item will always be at least its minimal size
if the total space is at least equal to the sum of minimal sizes of the
children but that if there is enough space, the proportions will be respected
too.

Extended the unit test to check that laying out various combinations of three
elements results in the expected results.

Closes #11311.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63706 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-18 15:07:24 +00:00
Vadim Zeitlin
a71aeb2426 Ensure that size in the minor direction of box sizer doesn't exceed the total.
This is similar to the previous commit but for the transversal direction of a
box sizer: we could give an item size larger than the size of the sizer itself
making only part of its window visible (and thus potentially making the window
unusable e.g. because the scrollbar wasn't visible at all).

Fix this by always restricting the item size in the minor direction to the
total size available and add a unit test which failed previously and passes
now.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63705 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-18 15:07:19 +00:00
Vadim Zeitlin
26022721e8 Ensure that size in the major direction of box sizer doesn't exceed the total.
After fixing the problem with "growing items by negative proportion" in r56010
(which still was the correct thing to do as it fixed such indefensibly broken
behaviour as shrinking items with larger proportion by more than "smaller"
items when there was not enough space) the items in a box sizer could become
larger than the total space allocated to the sizer resulting in only parts of
them being visible.

Fix this by truncating the items to the (remaining) total size even if this
means making them less than their minimal sizes -- because there is nothing
else we can do when the total space is smaller than the sum of minimal sizes
anyhow.

Closes #10008.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63704 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-18 15:07:14 +00:00
Vadim Zeitlin
869c7a944b Add (a very simple for now) wxBoxSizer unit test.
Only check that layout for a single sizer item works correctly for now.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63703 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-18 15:07:10 +00:00
Vadim Zeitlin
968d3a2461 Fix test for compilers not supporting \u escapes in strings (such as VC6).
Also reformat the code to follow wx style and explicitly use UTF-8 for the
test strings encoding instead of assuming the encoding of the current locale
was UTF-8 (which is never the case under Windows).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63685 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-14 14:47:11 +00:00
Vadim Zeitlin
a41b1a1bba Set correct properties for the new file added in r63660.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63684 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-14 14:44:25 +00:00
Francesco Montorsi
a37da0fa55 Fix function wxControlBase::DoEllipsizeSingleLine to really make sure that the ellipsized string takes less pixels than maxFinalWidthPx.
Add comments to explain in more details what the function does and in particular the valid ranges of all internal variables; fix in that regard both the code of both wxELLIPSIZE_START, wxELLIPSIZE_MIDDLE and wxELLIPSIZE_END.
Add more asserts to check the valid ranges and turn a couple of time-expensive checks in level-2 asserts.
Add a test unit for the wxControl::Ellipsize function.
Fix minor details in the docs of wxControl::Ellipsize.
Closes #11567.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-03-10 13:57:47 +00:00
Vadim Zeitlin
0c550516dd Fix bug in wxStringOutputStream unit test.
We wrote an extra NUL byte to the stream and, unsurprisingly, contents of its
buffer didn't match the original string resulting in the test failure.

Also get rid of a #if wxUSE_UNICODE.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63249 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-01-24 11:33:24 +00:00
Vadim Zeitlin
975fb32b5c Don't crash when input is empty in wxFileConfig(wxInputStream) ctor.
Fix crash due to dereferencing a NULL pointer when the input buffer in
wxFileConfig ctor is empty.

Closes #11636.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63228 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-01-23 13:22:14 +00:00
Vadim Zeitlin
cbab155657 No real changes, just fix a typo in comments and documentation.
Use "surprising" instead of (common) "surprizing" misspelling.

Closes #11627.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63154 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-01-14 18:02:26 +00:00
Vadim Zeitlin
4cb0e8d05c Fix wxConvAuto behaviour when it is used by wxTextInputStream.
wxConvAuto implicitly supposed that the chunk of data passed to it for
translation was big enough to allow it to at least detect the BOM from it.
However this isn't necessarily the case and never is with wxTextInputStream
which reads the bytes one by one.

Fix this by waiting until we have enough data to be able to detect the BOM.
This still doesn't fix the problem with streams without BOM and the
corresponding unit test still fails -- it will need to be fixed at the level
of wxTextInputStream itself later but handling correctly the cases when a BOM
is present is already better than before.

See #11570.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63064 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-01-04 12:22:49 +00:00
Vadim Zeitlin
595c23b34e Compilation fix for VC6 after r63061.
VC6 doesn't support empty struct initializers apparently.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63062 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-01-04 12:22:34 +00:00
Vadim Zeitlin
8b7d411f14 Correctly parse times without seconds in wxDateTime::ParseTime().
This was always supposed to work but never did because of a typo in the "24
hour format without seconds" format specification. Fix this by removing the
extra "%S" from it and add a test for this case.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63061 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-01-04 11:05:47 +00:00
Kevin Ollivier
da8b1d4b3b Rebake from clean wx tree.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63052 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-01-04 00:45:45 +00:00
Michael Wetherell
9e477451a1 Add another test for sparse file support so that the large file tests can run
as part of the default suite for more platforms.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63024 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-12-30 17:44:09 +00:00
Michael Wetherell
c896c76129 Repair the stream tests.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63022 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-12-30 17:39:47 +00:00
Michael Wetherell
224d978ffb Add support for large stdio files for VC 8+. What versions of the other Windows
compilers?


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62974 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-12-22 21:22:59 +00:00
Vadim Zeitlin
404013f849 Correct wxDateTime::GetWeekOfMonth() for days in the beginning of January.
This function was implemented in terms of GetWeekOfYear() which made it tricky
to get it right as GetWeekOfYear() can, correctly, return week number for the
previous year for the first days of January (and also from the next one for
the last days of December).

Replace this implementation with a simple one directly counting the number of
weeks since the first of the month, this seems to be much simpler and does
pass the new unit test case which the old version failed.

Also make the unit test failures more informative by using
WX_ASSERT_EQUAL_MESSAGE() instead of CPPUNIT_ASSERT_EQUAL().

See #11561.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62916 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-12-17 17:51:12 +00:00
Vadim Zeitlin
94b6ce7f4b Use X64 machine type for MSVC linker instead of old AMD64.
The officially supported machine type name is X64 now, even if AMD64 is still
supported.

Closes #10711.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62825 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-12-08 16:36:37 +00:00
Vadim Zeitlin
2730723380 Correct two bugs in wxMBConv::FromWChar() with non NUL-terminated strings.
The variable "lenChunk" was incorrectly used as the length of the wide string
chunk which could result in wrong output.

Worse, the output buffer could be overflown for the final chunk because it
didn't have to have enough space for the trailing NUL(s) in it.

Fix both bugs and added unit tests for them.

Based on patch by Kuang-che Wu.

Closes #11486.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62793 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-12-06 02:30:05 +00:00
Vadim Zeitlin
e01a788ee0 Add support for MSW unique volume names to wxFileName.
Recognize the paths starting with "\\?\Volume{GUID}" under MSW and provide a
way to test for them.

Closes #8874.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62782 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-12-05 17:31:00 +00:00
Vadim Zeitlin
874dbd3a4a Allow calling wxStrchr() with a narrow string and wide character.
Calls to wxStrchr(char-string, wide-char) would previously fail if wide
character couldn't be converted to a single character in the current locale
encoding. Change it to simply return NULL in this case as it's a safe and
useful generalization: a narrow string will never contain a wide character not
representable in the current locale.

Add wxUniChar::GetAsChar() to help with implementing this.

Closes #11487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62738 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-28 14:37:03 +00:00
Vadim Zeitlin
009f89f75d Make the assert in SettingsTestCase::GlobalFonts() more informative.
Show the index of the font and the face name which was invalid.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62707 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-24 00:01:51 +00:00
Jaakko Salli
7db064f60f Added typeinfo.h which implements wxTypeId, using C++ RTTI if available. wxAny and Unbind<>() code are updated to use it. Added and updated related unit tests.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62690 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-19 19:27:24 +00:00
Kevin Ollivier
f82b7036e8 Rebake after last commit.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62682 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-18 19:22:58 +00:00
Vadim Zeitlin
acaa833787 Fix unit test added in r62561 to work under Windows too.
The unit test checking that slashes were allowed in UNCs too didn't work under
Windows because GetPath() returned volume as part of the path there (and also
used backslashes by default), fix it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62579 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-09 18:20:05 +00:00
Vadim Zeitlin
7b611a3ae9 Recognize UNCs starting with forward slashes too in wxFileName.
Treat \\share\path and //share/path in the same way (for wxPATH_DOS paths).

Add a test for UNC parsing to the unit test.

Closes #11376.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62561 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-05 14:59:39 +00:00
Kevin Ollivier
a7ebaf0ddd Bakefile 0.2.8 rebake.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62522 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-31 20:56:47 +00:00
Kevin Ollivier
dbc7ceb925 Initial ShowWithoutActivating implementations for Mac and Windows, and attempt to improve IsActive behavior on Mac. Also adding ShowWithoutActivating() and Show/Hide tests, but until the mainloop issues are resolved, not adding them to tests.bkl.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62508 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-30 05:04:47 +00:00
Vadim Zeitlin
8c9833d09e Rebaked using post-0.2.7 svn version of bakefile.
Unfortunately 0.2.7 release contained a bug in msvc backend which resulted in
warnings generated for each file compiled. Apply the fix from bakefile svn to
fix this (and test if no other problems are found).

Also update all makefile.unx after changes of r62477.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62488 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-23 17:48:21 +00:00
Vadim Zeitlin
77241feb3f Use an even more informative error message in wxFSW unit test.
Dump information about both events when we received two of them instead of the
(single) expected one.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62486 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-23 11:44:57 +00:00
Vadim Zeitlin
1c9c8e88c2 Give more informative error in wxFSW test.
Output more details when more than one event is unexpectedly received.
Hopefully this will allow to debug the test failure at build bot slaves which
doesn't seem to be happening locally.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62482 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-22 23:54:55 +00:00
Vadim Zeitlin
d5236dfffd Fix g++ compilation of wxFileSystemWatcher test after VC6 fix.
Enums can't be used to deduce template parameters so cast WAIT_DURATION to int
explicitly before passing it to wxString::Format().

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62481 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-22 23:54:47 +00:00
Vadim Zeitlin
771ce939f3 Fix wxFSW test compilation with VC6.
Work around an internal compiler error and don't initialize static variable
when declaring it as VC6 doesn't support this.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62480 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-22 16:57:41 +00:00
Vadim Zeitlin
7880889720 Rebake everything using bakefile 0.2.7.
Also updated aclocal inputs and regenerated configure.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62478 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-22 16:53:10 +00:00
Vadim Zeitlin
6b8ef0b35d Merge SOC2009_FSWATCHER branch into trunk.
Merges everything from the branch with only some minor changes, mostly renamed
wxUSE_FSWATCHER_{INOTIFY,KQUEUE} to wxHAS_{INOTIFY,KQUEUE}.

Add wxFileSystemWatcher and related classes.

Also introduces wxEventLoopSource.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62474 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-22 11:35:43 +00:00
Vadim Zeitlin
40152925d5 Extract operator<<(ostream, wxFileName) from filename test.
Putting this function in a header allows to reuse it in other tests, e.g. the
upcoming wxFileSystemWatcher one.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-22 11:34:43 +00:00
Vadim Zeitlin
5ba859da5c Remove unwanted solution files from the repository.
Remove VC9-only solution files from a couple of tests/utils/demos (there is
no reason at all to have only VC9 solutions: either we have all of [789] or
none of them) and also remove all solutions files for the ribbon sample which
were probably added mistakenly in the first place (as no other sample has
them).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62469 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-22 09:40:42 +00:00
Kevin Ollivier
d5e7ffcf7a Make sure all Bakefile formats that use CRLF line feeds are set to use CRLF in SVN.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62327 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-08 04:07:02 +00:00
Vadim Zeitlin
bbb0ff36db Fix another off-by-1 bug in wxMBConv::ToWChar().
When converting a fixed number of characters we need to take any NULs inside
the buffer being converted into account for our return value -- but this
wasn't done and converting 2 characters 'x' and '\0' returned only 1, even if
the length 2 was explicitly specified.

Fix this bug and add a unit test checking for it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62141 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-26 13:31:27 +00:00
Vadim Zeitlin
4bc9acbe16 No changes, just convert file to UTF-8.
All files in svn are supposed to use UTF-8 now so convert this one to UTF-8
too before committing more changes to it (which would be otherwise rejected by
pre-commit hook).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62140 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-26 13:31:20 +00:00
Vadim Zeitlin
884ca4e484 Abort on asserts in worker threads.
Throwing an exception from worker threads is useless as it is not caught by
our wxUnitTestProtector which only protects the main thread, so abort
immediately to be sure to provide at least some information about the problem
as otherwise nothing may be output at all and the program can end up
deadlocked.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61996 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-21 14:45:37 +00:00
Vadim Zeitlin
7b7ad6a7f2 Fix harmless unused variable warning.
The value of wxColour::Alpha() was assigned to a temporary variable which
wasn't used afterwards and Mac OS g++ warned about it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61984 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-21 08:44:25 +00:00
Vadim Zeitlin
97051666f0 Add missing header to fix wxAny test compilation under OS X.
And probably other Unix systems not using PCH.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61980 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-20 12:37:11 +00:00
Vadim Zeitlin
b0edecea48 Add wxColour::{Set,Get}RGB[A]().
These methods allow to operate with all 3 or 4 colour channels at once.

Add their implementation, documentation and a unit test for wxColour
exercising them.

Closes #9918.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61976 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-19 16:29:50 +00:00
Vadim Zeitlin
39601a7f74 Set svn properties correctly for the newly added files.
Set svn:keyword and, most importantly, svn:eol-style, to avoid having files
with DOS line endings in svn, for the new files added by r61971.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61973 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-19 15:41:08 +00:00
Jaakko Salli
9ae96ec2bd Fixed wxAny tests for VC6
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61972 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-19 10:13:31 +00:00
Jaakko Salli
178c77606f wxAny initial commit (closes #10932)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61971 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-19 08:51:11 +00:00
Vadim Zeitlin
3d156e937a Provide implementation for wxArrayString::resize().
This method was declared but not implemented in wxUSE_STL==0 build.

Also add unit test for this function.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61947 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-16 23:18:48 +00:00
Vadim Zeitlin
bf24fcddc3 Fix test compilation under OS X.
wxFileOffset and ssize_t are not the same type under this platform so using
CPPUNIT_ASSERT_EQUAL() with the arguments of these types fails. Use ssize_t
instead of wxFileOffset to fix this.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61903 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-13 12:26:03 +00:00
Vadim Zeitlin
227989f3e9 Write correct number of bytes in wxFile::Write(wxString).
This function was broken for conversions using more than one byte per
character (e.g. UTF-16 or UTF-32) and also even for UTF-8 for strings
containing NUL bytes as it used strlen() to determine the number of bytes to
write out instead of using the really needed number.

Fix this by using the wxCharBuffer::length() method which always returns the
correct value.

Also add a wxFile unit test verifying that it can correctly read back a string
written using any of UTF-8, UTF-16 or UTF-32.

Closes #11192.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61898 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-12 22:40:42 +00:00
Vadim Zeitlin
caa96da739 Extract TestFile class in a separate header.
This allows to reuse it in the other tests which need to create a temporary
file automatically destroyed on test exit.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61897 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-12 22:40:35 +00:00
Vadim Zeitlin
d12d9edacb Rebake all the samples, demos and tests makefiles.
This should have been committed together with the changes to the debug flags
handling in build/bakefiles in r61887.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61893 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-12 13:38:08 +00:00
Vadim Zeitlin
8076df5d81 regenerated
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61892 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-12 13:35:16 +00:00
Vadim Zeitlin
758f356c53 Fix bug with parsing concatenated switches in wxCmdLineParser.
The constructs such as "-abcd" were not parsed correctly, i.e. the same as "-a
-b -c -d" because the code tried to parse a non-existent option "abcd" even if
it was supposed to not do this -- fix this.

Closes #11180.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61851 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-09-07 23:00:05 +00:00
Vadim Zeitlin
2e51fb3041 Correct wxImage::Size() again; add unit tests for it.
wxImage::Size() didn't handle the paste position correctly.

Closes #7874.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61792 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-08-30 21:43:11 +00:00
Vadim Zeitlin
791f7574a0 Fix buffer overflow in wxURLDataObject.
The code in CFSTR_SHELLURLDataObject::GetDataHere() was confused by
ANSI/Unicode and ended up overwriting output buffer because of it. Moreover,
this function was actually completely unnecessary as the base class version
did work correctly.

Closes #11102 (thanks to Tim Kosse).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61788 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-08-30 17:25:42 +00:00
Vadim Zeitlin
69d31e3130 Output the extracted number from wxString::ToXXX() even if it returns false.
After the changes in r50710 wxString numeric conversion functions didn't
update their output parameter any more if the conversion failed because not
entire string was converted. This was incompatible with the old behaviour
which some existing code did rely on, so restore it and now always return the
number which was extracted from the beginning of the string if we found
anything at all, even if the function returns false.

Add unit test for the correct behaviour and updated the documentation.

Closes #11126.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61786 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-08-30 17:25:19 +00:00
Vadim Zeitlin
a6cf6bcfb4 Don't append text following CDATA section to its node itself.
Reset wxXmlParsingContext::lastAsText flag when CDATA section ends to avoid
appending the text following it to its node. Instead new text nodes should be
created for it.

Also update the unit test to not work around the bug any more.

Closes #10552.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61759 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-08-24 21:42:27 +00:00
Vadim Zeitlin
07890fbeb5 Never overflow the output buffer in wxBase64Decode().
Don't write extra NUL bytes obtained by decoding the padding at the end of
input into the output buffer as there may be not enough place in it for them.
And in any case the buffer is not (always) NUL-terminated as no NUL bytes are
obtained in absence of padding, so it's better to never terminate it for
consistency.

Closes #11101.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61753 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-08-23 22:25:12 +00:00