Work around a failure in TreeCtrlTestCase::SelectionChange() unit test.
We were getting an extra event under MSW if the control was initially unfocused, so do focus it. This is a work around as the extra event shouldn't occur but I'm too afraid of changing wxMSW code itself so close to 3.0. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74995 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
9d7f0c5f7e
commit
6a51bf145f
@ -349,7 +349,14 @@ void TreeCtrlTestCase::CollapseExpandEvents()
|
||||
void TreeCtrlTestCase::SelectionChange()
|
||||
{
|
||||
m_tree->ExpandAll();
|
||||
m_tree->UnselectAll();
|
||||
|
||||
// This is currently needed to work around a problem under wxMSW: clicking
|
||||
// on an item in an unfocused control generates two selection change events
|
||||
// because of the SetFocus() call in TVN_SELCHANGED handler in wxMSW code.
|
||||
// This is, of course, wrong on its own, but fixing it without breaking
|
||||
// anything else is non-obvious, so for now at least work around this
|
||||
// problem in the test.
|
||||
m_tree->SetFocus();
|
||||
|
||||
EventCounter changed(m_tree, wxEVT_TREE_SEL_CHANGED);
|
||||
EventCounter changing(m_tree, wxEVT_TREE_SEL_CHANGING);
|
||||
@ -370,6 +377,9 @@ void TreeCtrlTestCase::SelectionChange()
|
||||
sim.MouseClick();
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, changed.GetCount());
|
||||
CPPUNIT_ASSERT_EQUAL(1, changing.GetCount());
|
||||
|
||||
sim.MouseMove(point2);
|
||||
wxYield();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user