Skip to content

Commit

Permalink
Port QRegExp in tests, remove the wildcard example as no longer suppo…
Browse files Browse the repository at this point in the history
…rted

Signed-off-by: Matthew J. Milner <[email protected]>
  • Loading branch information
matterhorn103 committed Oct 24, 2024
1 parent c4ff1c8 commit 6e64a9d
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions tests/qtgui/generichighlightertest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,26 +109,17 @@ TEST(DISABLED_GenericHighlighterTest, exercise)
QTextCharFormat format;

GenericHighlighter::Rule& regexpRule = highlighter.addRule();
regexpRule.addPattern(
QRegExp("^.*regexp.*$", Qt::CaseSensitive, QRegExp::RegExp));
regexpRule.addPattern(QRegularExpression("^.*regexp.*$"));
format.setForeground(Qt::blue);
regexpRule.setFormat(format);

GenericHighlighter::Rule& regexpCapRule = highlighter.addRule();
regexpCapRule.addPattern(
QRegExp("^.*(this)[^\n]*(that).*$", Qt::CaseSensitive, QRegExp::RegExp));
regexpCapRule.addPattern(QRegularExpression("^.*(this)[^\n]*(that).*$"));
format.setForeground(Qt::yellow);
regexpCapRule.setFormat(format);

GenericHighlighter::Rule& wildcardRule = highlighter.addRule();
wildcardRule.addPattern(
QRegExp("A w*red.", Qt::CaseSensitive, QRegExp::Wildcard));
format.setForeground(Qt::red);
wildcardRule.setFormat(format);

GenericHighlighter::Rule& stringRule = highlighter.addRule();
stringRule.addPattern(QRegExp("This string will be green.", Qt::CaseSensitive,
QRegExp::FixedString));
stringRule.addPattern(QRegularExpression("This string will be green."));
format.setForeground(Qt::green);
stringRule.setFormat(format);

Expand Down

0 comments on commit 6e64a9d

Please sign in to comment.