forked from qt-creator/qt-creator
TextEditor: add tests for semantic highlighter
Change-Id: Id64c933f01c0dbc0e077656b6f4260b93e124311 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -23,8 +23,12 @@ class SyntaxHighlighterPrivate
|
||||
Q_DECLARE_PUBLIC(SyntaxHighlighter)
|
||||
public:
|
||||
SyntaxHighlighterPrivate()
|
||||
: SyntaxHighlighterPrivate(TextEditorSettings::fontSettings())
|
||||
{ }
|
||||
|
||||
SyntaxHighlighterPrivate(const FontSettings &fontSettings)
|
||||
{
|
||||
updateFormats(TextEditorSettings::fontSettings());
|
||||
updateFormats(fontSettings);
|
||||
}
|
||||
|
||||
QPointer<QTextDocument> doc;
|
||||
@@ -76,6 +80,16 @@ void SyntaxHighlighter::delayedRehighlight()
|
||||
rehighlight();
|
||||
}
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
SyntaxHighlighter::SyntaxHighlighter(QTextDocument *parent, const FontSettings &fontsettings)
|
||||
: QObject(parent), d_ptr(new SyntaxHighlighterPrivate(fontsettings))
|
||||
{
|
||||
d_ptr->q_ptr = this;
|
||||
if (parent)
|
||||
setDocument(parent);
|
||||
}
|
||||
#endif
|
||||
|
||||
void SyntaxHighlighterPrivate::applyFormatChanges(int from, int charsRemoved, int charsAdded)
|
||||
{
|
||||
bool formatsChanged = false;
|
||||
|
||||
Reference in New Issue
Block a user