Fix timeout problem in keyboard unit test

This commit is contained in:
Markus Gans 2020-08-16 02:01:47 +02:00
parent 5574104dd9
commit 2b33c1875a
10 changed files with 22 additions and 16 deletions

View File

@ -203,7 +203,7 @@ class Scrollviewdemo final : public finalcut::FDialog
void onClose (finalcut::FCloseEvent*) override;
// Callback method
void cb_quit (const finalcut::FWidget* = nullptr, const FDataPtr = nullptr);
void cb_quit();
// Data members
Scrollview sview{this};
@ -230,9 +230,8 @@ Scrollviewdemo::Scrollviewdemo (finalcut::FWidget* parent)
quit_btn.addCallback
(
"clicked",
finalcut::getFApplication(),
&finalcut::FApplication::cb_exitApp,
this
this,
&Scrollviewdemo::cb_quit
);
// Text label
@ -246,7 +245,7 @@ Scrollviewdemo::~Scrollviewdemo()
{ }
//----------------------------------------------------------------------
void Scrollviewdemo::cb_quit (const finalcut::FWidget*, const FDataPtr)
void Scrollviewdemo::cb_quit()
{
close();
}

View File

@ -63,7 +63,7 @@ FMouseControl* FApplication::mouse {nullptr}; // mouse control
int FApplication::loop_level {0}; // event loop level
int FApplication::quit_code {EXIT_SUCCESS};
bool FApplication::quit_now {false};
uInt64 FApplication::next_event_wait{50000}; // preset to 50 ms
uInt64 FApplication::next_event_wait {20000}; // preset to 20 ms
struct timeval FApplication::time_last_event{};
//----------------------------------------------------------------------

View File

@ -652,7 +652,7 @@ void FMenu::hideSubMenus()
}
//----------------------------------------------------------------------
void FMenu::hideSuperMenus()
void FMenu::hideSuperMenus() const
{
// hide all menus to the top
auto super = getSuperMenu();
@ -907,7 +907,7 @@ void FMenu::mouseUpOverBorder()
}
//----------------------------------------------------------------------
void FMenu::mouseMoveOverBorder (mouseStates& ms)
void FMenu::mouseMoveOverBorder (mouseStates& ms) const
{
// Mouse is moved over border or separator line

View File

@ -468,7 +468,10 @@ const char* FTermDetection::termtype_256color_quirks()
color256 = true;
if ( ! isScreenTerm() )
return (new_termtype = "gnome-256color");
{
new_termtype = "gnome-256color";
return new_termtype;
}
}
if ( ! color256 )

View File

@ -2802,7 +2802,7 @@ void FVTerm::printPaddingCharacter (FTermArea* area, const FChar& term_char)
}
//----------------------------------------------------------------------
void FVTerm::updateTerminalLine (uInt y)
void FVTerm::updateTerminalLine (uInt y) const
{
// Updates pending changes from line y to the terminal

View File

@ -64,10 +64,10 @@ struct FCallbackData
{ }
FCallbackData (const FCallbackData&) = default;
FCallbackData (FCallbackData&&) = default;
FCallbackData (FCallbackData&&) noexcept = default;
FCallbackData& operator = (const FCallbackData&) = default;
FCallbackData& operator = (FCallbackData&&) = default;
FCallbackData& operator = (FCallbackData&&) noexcept = default;
// Data members
FString cb_signal{};

View File

@ -231,7 +231,7 @@ class FDialog : public FWindow
FToolTip* tooltip{nullptr};
// Friend function from FMenu
friend void FMenu::hideSuperMenus();
friend void FMenu::hideSuperMenus() const;
};
// FDialog inline functions

View File

@ -180,7 +180,7 @@ class FMenu : public FWindow, public FMenuList
void openSubMenu (FMenu*, bool = false);
void closeOpenedSubMenu();
void hideSubMenus();
void hideSuperMenus();
void hideSuperMenus() const;
bool mouseDownOverList (const FPoint&);
void mouseDownSubmenu (const FMenuItem*);
void mouseDownSelection (FMenuItem*, bool&);
@ -189,7 +189,7 @@ class FMenu : public FWindow, public FMenuList
void mouseMoveSelection (FMenuItem*, mouseStates&);
void mouseMoveDeselection (FMenuItem*, mouseStates&);
void mouseUpOverBorder();
void mouseMoveOverBorder (mouseStates&);
void mouseMoveOverBorder (mouseStates&) const;
void passEventToSubMenu (FMouseEvent* const&);
void passEventToSuperMenu (FMouseEvent* const&);
void passEventToMenuBar (FMouseEvent* const&) const;

View File

@ -404,7 +404,7 @@ class FVTerm
static void cursorWrap();
bool printWrap (FTermArea*) const;
void printPaddingCharacter (FTermArea*, const FChar&);
void updateTerminalLine (uInt);
void updateTerminalLine (uInt) const;
bool updateTerminalCursor() const;
bool isInsideTerminal (const FPoint&) const;
bool isTermSizeChanged() const;

View File

@ -2860,6 +2860,10 @@ void FKeyboardTest::processInput()
if ( keyboard->isKeyPressed() )
keyboard->fetchKeyCode();
// Keyboard interval timeout 75 ms (= 75,000,000 ns)
const struct timespec ms[]{{0, 75000000L}};
nanosleep (ms, NULL);
}
//----------------------------------------------------------------------