Make wxUIActionSimulator works more reliably on GTK/X11
Add wxXSync class which adds delays between the synthesized events sufficient for them to be processed by the higher layers (X, GTK). This makes it possible to run the UI tests by default with wxGTK. Closes https://github.com/wxWidgets/wxWidgets/pull/1845
This commit is contained in:
committed by
Vadim Zeitlin
parent
fb5c13ed00
commit
59ad9f46e6
@@ -49,10 +49,8 @@ private:
|
||||
CPPUNIT_TEST( DeleteAllItems );
|
||||
WXUISIM_TEST( LabelEdit );
|
||||
WXUISIM_TEST( KeyDown );
|
||||
#ifndef __WXGTK__
|
||||
WXUISIM_TEST( CollapseExpandEvents );
|
||||
WXUISIM_TEST( SelectionChange );
|
||||
#endif // !__WXGTK__
|
||||
WXUISIM_TEST( Menu );
|
||||
CPPUNIT_TEST( ItemData );
|
||||
CPPUNIT_TEST( Iteration );
|
||||
@@ -79,10 +77,8 @@ private:
|
||||
void DeleteAllItems();
|
||||
void LabelEdit();
|
||||
void KeyDown();
|
||||
#ifndef __WXGTK__
|
||||
void CollapseExpandEvents();
|
||||
void SelectionChange();
|
||||
#endif // !__WXGTK__
|
||||
void Menu();
|
||||
void ItemData();
|
||||
void Iteration();
|
||||
@@ -349,10 +345,14 @@ void TreeCtrlTestCase::KeyDown()
|
||||
CPPUNIT_ASSERT_EQUAL(6, keydown.GetCount());
|
||||
}
|
||||
|
||||
#if !defined(__WXGTK__)
|
||||
|
||||
void TreeCtrlTestCase::CollapseExpandEvents()
|
||||
{
|
||||
#ifdef __WXGTK20__
|
||||
// Works locally, but not when run on Travis CI.
|
||||
if ( IsAutomaticTest() )
|
||||
return;
|
||||
#endif
|
||||
|
||||
m_tree->CollapseAll();
|
||||
|
||||
EventCounter collapsed(m_tree, wxEVT_TREE_ITEM_COLLAPSED);
|
||||
@@ -377,6 +377,12 @@ void TreeCtrlTestCase::CollapseExpandEvents()
|
||||
CPPUNIT_ASSERT_EQUAL(1, expanding.GetCount());
|
||||
CPPUNIT_ASSERT_EQUAL(1, expanded.GetCount());
|
||||
|
||||
#ifdef __WXGTK__
|
||||
// Don't even know the reason why, but GTK has to sleep
|
||||
// no less than 1200 for the test case to succeed.
|
||||
wxMilliSleep(1200);
|
||||
#endif
|
||||
|
||||
sim.MouseDblClick();
|
||||
wxYield();
|
||||
|
||||
@@ -428,8 +434,6 @@ void TreeCtrlTestCase::SelectionChange()
|
||||
CPPUNIT_ASSERT_EQUAL(2, changing.GetCount());
|
||||
}
|
||||
|
||||
#endif // !__WXGTK__
|
||||
|
||||
void TreeCtrlTestCase::Menu()
|
||||
{
|
||||
EventCounter menu(m_tree, wxEVT_TREE_ITEM_MENU);
|
||||
@@ -612,12 +616,13 @@ void TreeCtrlTestCase::Sort()
|
||||
|
||||
void TreeCtrlTestCase::KeyNavigation()
|
||||
{
|
||||
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
|
||||
#if wxUSE_UIACTIONSIMULATOR
|
||||
wxUIActionSimulator sim;
|
||||
|
||||
m_tree->CollapseAll();
|
||||
|
||||
m_tree->SelectItem(m_root);
|
||||
wxYield();
|
||||
|
||||
m_tree->SetFocus();
|
||||
sim.Char(WXK_RIGHT);
|
||||
@@ -635,6 +640,8 @@ void TreeCtrlTestCase::KeyNavigation()
|
||||
|
||||
CPPUNIT_ASSERT(!m_tree->IsExpanded(m_root));
|
||||
|
||||
wxYield();
|
||||
|
||||
sim.Char(WXK_RIGHT);
|
||||
sim.Char(WXK_DOWN);
|
||||
wxYield();
|
||||
|
Reference in New Issue
Block a user