Remove minus since it's an invalid literal

This commit is contained in:
thez3ro 2017-12-30 14:16:18 +01:00
parent e803076063
commit 6d046f251e
No known key found for this signature in database
GPG Key ID: F628F9E41DD7C073
3 changed files with 6 additions and 3 deletions

View File

@ -616,7 +616,7 @@ bool AutoType::checkSyntax(const QString& string)
// the ":" allows custom commands with syntax S:Field
// exclude BEEP otherwise will be checked as valid
QString normalCommands = "(?!BEEP\\s)[A-Z:]*" + allowRepetition;
QString specialLiterals = "[\\^\\%\\(\\)~\\{\\}\\[\\]\\+-]" + allowRepetition;
QString specialLiterals = "[\\^\\%\\(\\)~\\{\\}\\[\\]\\+]" + allowRepetition;
QString functionKeys = "(?:F[1-9]" + allowRepetition + "|F1[0-2])" + allowRepetition;
QString numpad = "NUMPAD\\d" + allowRepetition;
QString delay = "DELAY=\\d+";

View File

@ -31,7 +31,6 @@
#include <QTemporaryFile>
#include <QMimeData>
#include <QEvent>
#include <iostream>
#include "autotype/AutoType.h"
#include "core/Config.h"

View File

@ -286,7 +286,7 @@ void TestAutoType::testGlobalAutoTypeRegExp()
void TestAutoType::testAutoTypeSyntaxChecks()
{
// Huge sequence
QCOMPARE(true, AutoType::checkSyntax("{word 23}{F1 23}{~ 23}{% 23}{^}{F12}{(}{) 23}{[}{[}{]}{Delay=23}{+}{-}~+%@fixedstring"));
QCOMPARE(true, AutoType::checkSyntax("{word 23}{F1 23}{~ 23}{% 23}{^}{F12}{(}{) 23}{[}{[}{]}{Delay=23}{+}{SUBTRACT}~+%@fixedstring"));
QCOMPARE(true, AutoType::checkSyntax("{NUMPAD1 3}"));
@ -298,6 +298,10 @@ void TestAutoType::testAutoTypeSyntaxChecks()
QCOMPARE(true, AutoType::checkSyntax("{VKEY-EX 0x01}"));
// Bad sequence
QCOMPARE(false, AutoType::checkSyntax("{{{}}{}{}}{{}}"));
// Good sequence
QCOMPARE(true, AutoType::checkSyntax("{{}{}}{}}{{}"));
QCOMPARE(true, AutoType::checkSyntax("{]}{[}{[}{]}"));
QCOMPARE(true, AutoType::checkSyntax("{)}{(}{(}{)}"));
// High DelAY / low delay
QCOMPARE(true, AutoType::checkHighDelay("{DelAY 50000}"));
QCOMPARE(false, AutoType::checkHighDelay("{delay 50}"));