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 9d7a7ec556 (which
mistakenly may have had treectrltest.cpp as part of its commit).
This commit is contained in:
Dimitri Schoolwerth
2015-04-16 03:13:54 +04:00
parent c7c63590ae
commit 25fcb85590
2 changed files with 12 additions and 9 deletions

View File

@@ -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

View File

@@ -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));