From 25fcb855909e7fd93f388951b40f1ec0b69edcb0 Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Thu, 16 Apr 2015 03:13:54 +0400 Subject: [PATCH] Fix TreeCtrlTestCase assert failure under Windows. A '-' keypress doesn't collapse a tree item with the native MSW tree control. Instead, when not using the generic tree control, simulate a keypress of WXK_LEFT to collapse the root item . This fixes the assert checking if the root item is collapsed after the keypress. Regression since 9d7a7ec5560a4f770cb4288abdaf28ce768ed15f (which mistakenly may have had treectrltest.cpp as part of its commit). --- include/wx/treectrl.h | 16 +++++++--------- tests/controls/treectrltest.cpp | 5 +++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/wx/treectrl.h b/include/wx/treectrl.h index 94fff8add4..2a958abac3 100644 --- a/include/wx/treectrl.h +++ b/include/wx/treectrl.h @@ -25,6 +25,10 @@ class WXDLLIMPEXP_FWD_CORE wxImageList; +#ifndef __WXMSW__ + #define wxHAS_GENERIC_TREECTRL +#endif + // ---------------------------------------------------------------------------- // wxTreeCtrlBase // ---------------------------------------------------------------------------- @@ -456,18 +460,12 @@ private: // include the platform-dependent wxTreeCtrl class // ---------------------------------------------------------------------------- -#if defined(__WXUNIVERSAL__) +#ifdef wxHAS_GENERIC_TREECTRL #include "wx/generic/treectlg.h" #elif defined(__WXMSW__) #include "wx/msw/treectrl.h" -#elif defined(__WXMOTIF__) - #include "wx/generic/treectlg.h" -#elif defined(__WXGTK__) - #include "wx/generic/treectlg.h" -#elif defined(__WXMAC__) - #include "wx/generic/treectlg.h" -#elif defined(__WXQT__) - #include "wx/generic/treectlg.h" +#else + #error "unknown native wxTreeCtrl implementation" #endif #endif // wxUSE_TREECTRL diff --git a/tests/controls/treectrltest.cpp b/tests/controls/treectrltest.cpp index d383016045..e7ce5d97bf 100644 --- a/tests/controls/treectrltest.cpp +++ b/tests/controls/treectrltest.cpp @@ -587,7 +587,12 @@ void TreeCtrlTestCase::KeyNavigation() CPPUNIT_ASSERT(m_tree->IsExpanded(m_root)); +#ifdef wxHAS_GENERIC_TREECTRL sim.Char('-'); +#else + sim.Char(WXK_LEFT); +#endif + wxYield(); CPPUNIT_ASSERT(!m_tree->IsExpanded(m_root));