Add support for space token to keyboard_input

This commit is contained in:
Vasily
2019-05-25 18:49:42 +02:00
committed by username223
parent e40058e58a
commit ef0e679344
2 changed files with 16 additions and 1 deletions
+6 -1
View File
@@ -74,7 +74,12 @@ std::vector<Token> ParseKeyboardInputsToTokens( const std::string inputs )
continue;
}
if ( !isupper( *ch ) )
if ( isspace( *ch ) )
{
tokens.push_back( Token::TOKEN_NEW_SEQUENCE );
}
if ( !isupper( *ch ) || isspace( *ch ) )
{
// LOG incorrect character
continue;
+10
View File
@@ -26,6 +26,8 @@ private slots:
void functionKeys();
void shouldExitEarlyFunctionKey();
void releaseHeldKeys();
};
const std::string alphabet = "abcdefghijklmnopqrstuvxyz";
@@ -185,6 +187,14 @@ void ParserTest::shouldExitEarlyFunctionKey()
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 )
#include "tst_parsertest.moc"