improve regex filtering

This commit is contained in:
thez3ro 2017-12-28 14:12:17 +01:00
parent 203960b4b5
commit e803076063
No known key found for this signature in database
GPG key ID: F628F9E41DD7C073
4 changed files with 88 additions and 82 deletions

View file

@ -287,11 +287,23 @@ void TestAutoType::testAutoTypeSyntaxChecks()
{
// Huge sequence
QCOMPARE(true, AutoType::checkSyntax("{word 23}{F1 23}{~ 23}{% 23}{^}{F12}{(}{) 23}{[}{[}{]}{Delay=23}{+}{-}~+%@fixedstring"));
QCOMPARE(true, AutoType::checkSyntax("{NUMPAD1 3}"));
QCOMPARE(true, AutoType::checkSyntax("{BEEP 3 3}"));
QCOMPARE(false, AutoType::checkSyntax("{BEEP 3}"));
QCOMPARE(true, AutoType::checkSyntax("{VKEY 0x01}"));
QCOMPARE(true, AutoType::checkSyntax("{VKEY VK_LBUTTON}"));
QCOMPARE(true, AutoType::checkSyntax("{VKEY-EX 0x01}"));
// Bad sequence
QCOMPARE(false, AutoType::checkSyntax("{{{}}{}{}}{{}}"));
// High DelAY / low delay
QCOMPARE(true, AutoType::checkHighDelay("{DelAY 50000}"));
QCOMPARE(false, AutoType::checkHighDelay("{delay 50}"));
// Slow typing
QCOMPARE(true, AutoType::checkSlowKeypress("{DelAY=50000}"));
QCOMPARE(false, AutoType::checkSlowKeypress("{delay=50}"));
// Many repetition / few repetition / delay not repetition
QCOMPARE(true, AutoType::checkHighRepetition("{LEFT 50000000}"));
QCOMPARE(false, AutoType::checkHighRepetition("{SPACE 10}{TAB 3}{RIGHT 50}"));