diff options
author | thez3ro <io@thezero.org> | 2017-11-07 19:58:08 +0300 |
---|---|---|
committer | thez3ro <io@thezero.org> | 2018-01-03 14:56:18 +0300 |
commit | a02a49a1841aba425f6186e6e8b88470b3cdd008 (patch) | |
tree | 651bb7b25b69bc73be7a663dc80a17cab9dc6001 /tests | |
parent | 8ca444aee005dd37284d83591a6f3c18f5c2ef66 (diff) |
add test for syntax checking
Diffstat (limited to 'tests')
-rw-r--r-- | tests/TestAutoType.cpp | 15 | ||||
-rw-r--r-- | tests/TestAutoType.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/TestAutoType.cpp b/tests/TestAutoType.cpp index acc2df61f..d1c09c263 100644 --- a/tests/TestAutoType.cpp +++ b/tests/TestAutoType.cpp @@ -282,3 +282,18 @@ void TestAutoType::testGlobalAutoTypeRegExp() QCOMPARE(m_test->actionChars(), QString("custom_attr_third")); m_test->clearActions(); } + +void TestAutoType::testAutoTypeSyntaxChecks() +{ + // Huge sequence + QCOMPARE(true, AutoType::checkSyntax("{word 23}{F1 23}{~ 23}{% 23}{^}{F12}{(}{) 23}{[}{[}{]}{Delay=23}{+}{-}~+%@fixedstring")); + // Bad sequence + QCOMPARE(false, AutoType::checkSyntax("{{{}}{}{}}{{}}")); + // High DelAY / low delay + QCOMPARE(true, AutoType::checkHighDelay("{DelAY 50000}")); + QCOMPARE(false, AutoType::checkHighDelay("{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}")); + QCOMPARE(false, AutoType::checkHighRepetition("{delay 5000000000}")); +}
\ No newline at end of file diff --git a/tests/TestAutoType.h b/tests/TestAutoType.h index 0cd4a5bdd..b7c33823b 100644 --- a/tests/TestAutoType.h +++ b/tests/TestAutoType.h @@ -47,6 +47,7 @@ private slots: void testGlobalAutoTypeUrlSubdomainMatch(); void testGlobalAutoTypeTitleMatchDisabled(); void testGlobalAutoTypeRegExp(); + void testAutoTypeSyntaxChecks(); private: AutoTypePlatformInterface* m_platform; |