Add support for space token to keyboard_input
This commit is contained in:
@@ -74,7 +74,12 @@ std::vector<Token> ParseKeyboardInputsToTokens( const std::string inputs )
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !isupper( *ch ) )
|
if ( isspace( *ch ) )
|
||||||
|
{
|
||||||
|
tokens.push_back( Token::TOKEN_NEW_SEQUENCE );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !isupper( *ch ) || isspace( *ch ) )
|
||||||
{
|
{
|
||||||
// LOG incorrect character
|
// LOG incorrect character
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ private slots:
|
|||||||
void functionKeys();
|
void functionKeys();
|
||||||
|
|
||||||
void shouldExitEarlyFunctionKey();
|
void shouldExitEarlyFunctionKey();
|
||||||
|
|
||||||
|
void releaseHeldKeys();
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::string alphabet = "abcdefghijklmnopqrstuvxyz";
|
const std::string alphabet = "abcdefghijklmnopqrstuvxyz";
|
||||||
@@ -185,6 +187,14 @@ void ParserTest::shouldExitEarlyFunctionKey()
|
|||||||
QVERIFY( t == e );
|
QVERIFY( t == e );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ParserTest::releaseHeldKeys()
|
||||||
|
{
|
||||||
|
auto t = ParseKeyboardInputsToTokens( "a s" );
|
||||||
|
auto e = std::vector<Token>(
|
||||||
|
{ Token::KEY_a, Token::TOKEN_NEW_SEQUENCE, Token::KEY_s } );
|
||||||
|
QVERIFY( t == e );
|
||||||
|
}
|
||||||
|
|
||||||
QTEST_APPLESS_MAIN( ParserTest )
|
QTEST_APPLESS_MAIN( ParserTest )
|
||||||
|
|
||||||
#include "tst_parsertest.moc"
|
#include "tst_parsertest.moc"
|
||||||
|
|||||||
Reference in New Issue
Block a user