Commit 59259df5 authored by hjk's avatar hjk
Browse files

Vcs: Convert to new editor construction scheme



Change-Id: I4b4516c8cdf1a934a7865ac6dce904a244995b5b
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent 5f7e89d9
...@@ -655,9 +655,7 @@ void BazaarPlugin::testDiffFileResolving_data() ...@@ -655,9 +655,7 @@ void BazaarPlugin::testDiffFileResolving_data()
void BazaarPlugin::testDiffFileResolving() void BazaarPlugin::testDiffFileResolving()
{ {
BazaarEditorWidget editor; VcsBaseEditorWidget::testDiffFileResolving(editorParameters[2].id);
editor.setParameters(editorParameters + 2);
editor.testDiffFileResolving();
} }
void BazaarPlugin::testLogResolving() void BazaarPlugin::testLogResolving()
...@@ -680,9 +678,7 @@ void BazaarPlugin::testLogResolving() ...@@ -680,9 +678,7 @@ void BazaarPlugin::testLogResolving()
" (gz) Set approved revision and vote \"Approve\" when using lp-propose\n" " (gz) Set approved revision and vote \"Approve\" when using lp-propose\n"
" --approve (Jonathan Lange)\n" " --approve (Jonathan Lange)\n"
); );
BazaarEditorWidget editor; VcsBaseEditorWidget::testLogResolving(editorParameters[0].id, data, "6572", "6571");
editor.setParameters(editorParameters);
editor.testLogResolving(data, "6572", "6571");
} }
#endif #endif
......
...@@ -70,7 +70,6 @@ ...@@ -70,7 +70,6 @@
#include <vcsbase/vcsoutputwindow.h> #include <vcsbase/vcsoutputwindow.h>
#include <vcsbase/vcsbasesubmiteditor.h> #include <vcsbase/vcsbasesubmiteditor.h>
#include <QAction> #include <QAction>
#include <QDebug> #include <QDebug>
#include <QDialog> #include <QDialog>
...@@ -105,7 +104,7 @@ ...@@ -105,7 +104,7 @@
using namespace Core; using namespace Core;
using namespace ProjectExplorer; using namespace ProjectExplorer;
using VcsBase::VcsOutputWindow; using namespace VcsBase;
namespace ClearCase { namespace ClearCase {
namespace Internal { namespace Internal {
...@@ -2227,9 +2226,7 @@ void ClearCasePlugin::testDiffFileResolving_data() ...@@ -2227,9 +2226,7 @@ void ClearCasePlugin::testDiffFileResolving_data()
void ClearCasePlugin::testDiffFileResolving() void ClearCasePlugin::testDiffFileResolving()
{ {
ClearCaseEditorWidget editor; VcsBaseEditorWidget::testDiffFileResolving(editorParameters[2].id);
editor.setParameters(editorParameters + 2);
editor.testDiffFileResolving();
} }
void ClearCasePlugin::testLogResolving() void ClearCasePlugin::testLogResolving()
...@@ -2238,9 +2235,7 @@ void ClearCasePlugin::testLogResolving() ...@@ -2238,9 +2235,7 @@ void ClearCasePlugin::testLogResolving()
"13-Sep.17:41 user1 create version \"src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/9\" (baseline1, baseline2, ...)\n" "13-Sep.17:41 user1 create version \"src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/9\" (baseline1, baseline2, ...)\n"
"22-Aug.14:13 user2 create version \"src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/8\" (baseline3, baseline4, ...)\n" "22-Aug.14:13 user2 create version \"src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/8\" (baseline3, baseline4, ...)\n"
); );
ClearCaseEditorWidget editor; VcsBaseEditorWidget::testLogResolving(editorParameters[0].id, data,
editor.setParameters(editorParameters);
editor.testLogResolving(data,
"src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/9", "src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/9",
"src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/8"); "src/plugins/clearcase/clearcaseeditor.h@@/main/branch1/branch2/8");
} }
......
...@@ -1319,9 +1319,7 @@ void CvsPlugin::testDiffFileResolving_data() ...@@ -1319,9 +1319,7 @@ void CvsPlugin::testDiffFileResolving_data()
void CvsPlugin::testDiffFileResolving() void CvsPlugin::testDiffFileResolving()
{ {
CvsEditorWidget editor; VcsBaseEditorWidget::testDiffFileResolving(editorParameters[3].id);
editor.setParameters(editorParameters + 3);
editor.testDiffFileResolving();
} }
void CvsPlugin::testLogResolving() void CvsPlugin::testLogResolving()
...@@ -1347,9 +1345,7 @@ void CvsPlugin::testLogResolving() ...@@ -1347,9 +1345,7 @@ void CvsPlugin::testLogResolving()
"added latest commentary\n" "added latest commentary\n"
"----------------------------\n" "----------------------------\n"
); );
CvsEditorWidget editor; VcsBaseEditorWidget::testLogResolving(editorParameters[1].id, data, "1.3", "1.2");
editor.setParameters(editorParameters + 1);
editor.testLogResolving(data, "1.3", "1.2");
} }
#endif #endif
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#include <coreplugin/infobar.h> #include <coreplugin/infobar.h>
#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h> #include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/locator/commandlocator.h>
#include <coreplugin/mimedatabase.h> #include <coreplugin/mimedatabase.h>
#include <coreplugin/vcsmanager.h> #include <coreplugin/vcsmanager.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
...@@ -72,7 +73,6 @@ ...@@ -72,7 +73,6 @@
#include <vcsbase/basevcssubmiteditorfactory.h> #include <vcsbase/basevcssubmiteditorfactory.h>
#include <vcsbase/vcsoutputwindow.h> #include <vcsbase/vcsoutputwindow.h>
#include <vcsbase/cleandialog.h> #include <vcsbase/cleandialog.h>
#include <coreplugin/locator/commandlocator.h>
#include <QDebug> #include <QDebug>
#include <QDir> #include <QDir>
...@@ -1523,9 +1523,7 @@ void GitPlugin::testDiffFileResolving_data() ...@@ -1523,9 +1523,7 @@ void GitPlugin::testDiffFileResolving_data()
void GitPlugin::testDiffFileResolving() void GitPlugin::testDiffFileResolving()
{ {
GitEditorWidget editor; VcsBaseEditorWidget::testDiffFileResolving(editorParameters[3].id);
editor.setParameters(editorParameters + 3);
editor.testDiffFileResolving();
} }
void GitPlugin::testLogResolving() void GitPlugin::testLogResolving()
...@@ -1550,9 +1548,8 @@ void GitPlugin::testLogResolving() ...@@ -1550,9 +1548,8 @@ void GitPlugin::testLogResolving()
" \n" " \n"
" Signed-off-by: Junio C Hamano <gitster@pobox.com>\n" " Signed-off-by: Junio C Hamano <gitster@pobox.com>\n"
); );
GitEditorWidget editor;
editor.setParameters(editorParameters + 1); VcsBaseEditorWidget::testLogResolving(editorParameters[1].id, data,
editor.testLogResolving(data,
"50a6b54c - Merge branch 'for-junio' of git://bogomips.org/git-svn", "50a6b54c - Merge branch 'for-junio' of git://bogomips.org/git-svn",
"3587b513 - Update draft release notes to 1.8.2"); "3587b513 - Update draft release notes to 1.8.2");
} }
......
...@@ -722,9 +722,7 @@ void MercurialPlugin::testDiffFileResolving_data() ...@@ -722,9 +722,7 @@ void MercurialPlugin::testDiffFileResolving_data()
void MercurialPlugin::testDiffFileResolving() void MercurialPlugin::testDiffFileResolving()
{ {
MercurialEditorWidget editor; VcsBaseEditorWidget::testDiffFileResolving(editorParameters[2].id);
editor.setParameters(editorParameters + 2);
editor.testDiffFileResolving();
} }
void MercurialPlugin::testLogResolving() void MercurialPlugin::testLogResolving()
...@@ -744,9 +742,7 @@ void MercurialPlugin::testLogResolving() ...@@ -744,9 +742,7 @@ void MercurialPlugin::testLogResolving()
"date: Sat Jan 19 04:08:16 2013 +0100\n" "date: Sat Jan 19 04:08:16 2013 +0100\n"
"summary: test-rebase: add another test for rebase with multiple roots\n" "summary: test-rebase: add another test for rebase with multiple roots\n"
); );
MercurialEditorWidget editor; VcsBaseEditorWidget::testLogResolving(editorParameters[0].id, data, "18473:692cbda1eb50", "18472:37100f30590f");
editor.setParameters(editorParameters);
editor.testLogResolving(data, "18473:692cbda1eb50", "18472:37100f30590f");
} }
#endif #endif
......
...@@ -1555,9 +1555,7 @@ void PerforcePlugin::testLogResolving() ...@@ -1555,9 +1555,7 @@ void PerforcePlugin::testLogResolving()
"\n" "\n"
" Comment\n" " Comment\n"
); );
PerforceEditorWidget editor; VcsBaseEditorWidget::testLogResolving(editorParameters[0].id, data, "12345", "12344");
editor.setParameters(editorParameters);
editor.testLogResolving(data, "12345", "12344");
} }
#endif #endif
......
...@@ -1282,9 +1282,7 @@ void SubversionPlugin::testDiffFileResolving_data() ...@@ -1282,9 +1282,7 @@ void SubversionPlugin::testDiffFileResolving_data()
void SubversionPlugin::testDiffFileResolving() void SubversionPlugin::testDiffFileResolving()
{ {
SubversionEditorWidget editor; VcsBaseEditorWidget::testDiffFileResolving(editorParameters[2].id);
editor.setParameters(editorParameters + 2);
editor.testDiffFileResolving();
} }
void SubversionPlugin::testLogResolving() void SubversionPlugin::testLogResolving()
...@@ -1305,9 +1303,7 @@ void SubversionPlugin::testLogResolving() ...@@ -1305,9 +1303,7 @@ void SubversionPlugin::testLogResolving()
" expectations, remove XFail.\n" " expectations, remove XFail.\n"
"\n" "\n"
); );
SubversionEditorWidget editor; VcsBaseEditorWidget::testLogResolving(editorParameters[0].id, data, "r1439551", "r1439540");
editor.setParameters(editorParameters);
editor.testLogResolving(data, "r1439551", "r1439540");
} }
#endif #endif
......
...@@ -647,11 +647,12 @@ public: ...@@ -647,11 +647,12 @@ public:
void setEditorActionHandlers(Core::Id contextId, uint optionalActions); void setEditorActionHandlers(Core::Id contextId, uint optionalActions);
void setEditorActionHandlers(uint optionalActions); void setEditorActionHandlers(uint optionalActions);
Core::IEditor *createEditor();
private: private:
friend class BaseTextEditor; friend class BaseTextEditor;
friend class PlainTextEditorFactory; friend class PlainTextEditorFactory;
Core::IEditor *createEditor();
BaseTextEditor *createEditorHelper(const BaseTextDocumentPtr &doc); BaseTextEditor *createEditorHelper(const BaseTextDocumentPtr &doc);
BaseTextEditor *duplicateTextEditor(BaseTextEditor *); BaseTextEditor *duplicateTextEditor(BaseTextEditor *);
......
...@@ -279,6 +279,7 @@ SyntaxHighlighter::SyntaxHighlighter(QTextDocument *parent) ...@@ -279,6 +279,7 @@ SyntaxHighlighter::SyntaxHighlighter(QTextDocument *parent)
: QObject(parent), d_ptr(new SyntaxHighlighterPrivate) : QObject(parent), d_ptr(new SyntaxHighlighterPrivate)
{ {
d_ptr->q_ptr = this; d_ptr->q_ptr = this;
if (parent)
setDocument(parent); setDocument(parent);
} }
...@@ -291,6 +292,7 @@ SyntaxHighlighter::SyntaxHighlighter(QTextEdit *parent) ...@@ -291,6 +292,7 @@ SyntaxHighlighter::SyntaxHighlighter(QTextEdit *parent)
: QObject(parent), d_ptr(new SyntaxHighlighterPrivate) : QObject(parent), d_ptr(new SyntaxHighlighterPrivate)
{ {
d_ptr->q_ptr = this; d_ptr->q_ptr = this;
if (parent)
setDocument(parent->document()); setDocument(parent->document());
} }
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include <texteditor/texteditoractionhandler.h> #include <texteditor/texteditoractionhandler.h>
#include <diffeditor/diffeditorconstants.h> #include <diffeditor/diffeditorconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h>
#include <QCoreApplication> #include <QCoreApplication>
#include <QStringList> #include <QStringList>
...@@ -49,62 +51,44 @@ using namespace TextEditor; ...@@ -49,62 +51,44 @@ using namespace TextEditor;
*/ */
namespace VcsBase { namespace VcsBase {
namespace Internal {
class BaseVcsEditorFactoryPrivate
{
public:
const VcsBaseEditorParameters *m_parameters;
QObject *m_describeReceiver;
const char *m_describeSlot;
BaseTextEditorFactory::EditorWidgetCreator m_widgetCreator;
};
} // namespace Internal
VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters, VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters,
const BaseTextEditorFactory::EditorWidgetCreator &creator, const EditorWidgetCreator &editorWidgetCreator,
QObject *describeReceiver, const char *describeSlot) QObject *describeReceiver, const char *describeSlot)
: d(new Internal::BaseVcsEditorFactoryPrivate)
{ {
d->m_parameters = parameters; setProperty("VcsEditorFactoryName", QByteArray(parameters->id));
d->m_describeReceiver = describeReceiver;
d->m_describeSlot = describeSlot;
d->m_widgetCreator = creator;
setId(parameters->id); setId(parameters->id);
setDisplayName(QCoreApplication::translate("VCS", parameters->displayName)); setDisplayName(QCoreApplication::translate("VCS", parameters->displayName));
if (QLatin1String(parameters->mimeType) != QLatin1String(DiffEditor::Constants::DIFF_EDITOR_MIMETYPE)) if (QLatin1String(parameters->mimeType) != QLatin1String(DiffEditor::Constants::DIFF_EDITOR_MIMETYPE))
addMimeType(parameters->mimeType); addMimeType(parameters->mimeType);
new TextEditor::TextEditorActionHandler(this, parameters->context);
}
VcsEditorFactory::~VcsEditorFactory() setEditorActionHandlers(parameters->context, TextEditorActionHandler::None);
{
delete d; setDocumentCreator([=]() {
auto document = new BaseTextDocument(parameters->id);
// if (QLatin1String(parameters->mimeType) != QLatin1String(DiffEditor::Constants::DIFF_EDITOR_MIMETYPE))
document->setMimeType(QLatin1String(parameters->mimeType));
return document;
});
setEditorWidgetCreator([=]() {
auto widget = qobject_cast<VcsBaseEditorWidget *>(editorWidgetCreator());
widget->setDescribeSlot(describeReceiver, describeSlot);
widget->setParameters(parameters);
return widget;
});
setEditorCreator([=]() {
return new VcsBaseEditor(parameters);
});
} }
Core::IEditor *VcsEditorFactory::createEditor() VcsBaseEditor *VcsEditorFactory::createEditorById(const char *id)
{ {
TextEditor::BaseTextEditor *editor = new VcsBaseEditor(d->m_parameters); auto factory = ExtensionSystem::PluginManager::getObject<VcsEditorFactory>(
[id](QObject *ob) { return ob->property("VcsEditorFactoryName").toByteArray() == id; });
VcsBaseEditorWidget *widget = qobject_cast<VcsBaseEditorWidget *>(d->m_widgetCreator()); QTC_ASSERT(factory, return 0);
widget->setParameters(d->m_parameters); return qobject_cast<VcsBaseEditor *>(factory->createEditor());
// Pass on signals.
connect(widget, SIGNAL(describeRequested(QString,QString)),
editor, SIGNAL(describeRequested(QString,QString)));
connect(widget, SIGNAL(annotateRevisionRequested(QString,QString,QString,int)),
editor, SIGNAL(annotateRevisionRequested(QString,QString,QString,int)));
editor->setEditorWidget(widget);
widget->init();
if (d->m_describeReceiver)
connect(widget, SIGNAL(describeRequested(QString,QString)), d->m_describeReceiver, d->m_describeSlot);
if (!mimeTypes().isEmpty())
widget->textDocument()->setMimeType(mimeTypes().front());
return editor;
} }
} // namespace VcsBase } // namespace VcsBase
...@@ -33,27 +33,22 @@ ...@@ -33,27 +33,22 @@
#include "vcsbase_global.h" #include "vcsbase_global.h"
#include "vcsbaseeditor.h" #include "vcsbaseeditor.h"
#include <coreplugin/editormanager/ieditorfactory.h>
#include <texteditor/basetexteditor.h> #include <texteditor/basetexteditor.h>
#include <QSharedPointer>
namespace VcsBase { namespace VcsBase {
namespace Internal { class BaseVcsEditorFactoryPrivate; }
class VCSBASE_EXPORT VcsEditorFactory : public Core::IEditorFactory class VCSBASE_EXPORT VcsEditorFactory : public TextEditor::BaseTextEditorFactory
{ {
Q_OBJECT Q_OBJECT
public: public:
VcsEditorFactory(const VcsBaseEditorParameters *type, VcsEditorFactory(const VcsBaseEditorParameters *parameters,
const TextEditor::BaseTextEditorFactory::EditorWidgetCreator &creator, const EditorWidgetCreator &editorWidgetCreator,
QObject *describeReceiver, QObject *describeReceiver,
const char *describeSlot); const char *describeSlot);
~VcsEditorFactory();
Core::IEditor *createEditor(); static VcsBaseEditor *createEditorById(const char *id);
private:
Internal::BaseVcsEditorFactoryPrivate *const d;
}; };
} // namespace VcsBase } // namespace VcsBase
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "vcsbaseeditor.h" #include "vcsbaseeditor.h"
#include "diffhighlighter.h" #include "diffhighlighter.h"
#include "baseannotationhighlighter.h" #include "baseannotationhighlighter.h"
#include "basevcseditorfactory.h"
#include "vcsbaseplugin.h" #include "vcsbaseplugin.h"
#include "vcsbaseeditorparameterwidget.h" #include "vcsbaseeditorparameterwidget.h"
#include "vcscommand.h" #include "vcscommand.h"
...@@ -559,6 +560,10 @@ public: ...@@ -559,6 +560,10 @@ public:
bool m_mouseDragging; bool m_mouseDragging;
QList<AbstractTextCursorHandler *> m_textCursorHandlers; QList<AbstractTextCursorHandler *> m_textCursorHandlers;
QPointer<VcsCommand> m_command; QPointer<VcsCommand> m_command;
QObject *m_describeReceiver;
const char *m_describeSlot;
private:
QComboBox *m_entriesComboBox; QComboBox *m_entriesComboBox;
}; };
...@@ -571,6 +576,8 @@ VcsBaseEditorWidgetPrivate::VcsBaseEditorWidgetPrivate(VcsBaseEditorWidget *edit ...@@ -571,6 +576,8 @@ VcsBaseEditorWidgetPrivate::VcsBaseEditorWidgetPrivate(VcsBaseEditorWidget *edit
m_fileLogAnnotateEnabled(false), m_fileLogAnnotateEnabled(false),
m_configurationWidget(0), m_configurationWidget(0),
m_mouseDragging(false), m_mouseDragging(false),
m_describeReceiver(0),
m_describeSlot(0),
m_entriesComboBox(0) m_entriesComboBox(0)
{ {
m_textCursorHandlers.append(new ChangeTextCursorHandler(editorWidget)); m_textCursorHandlers.append(new ChangeTextCursorHandler(editorWidget));
...@@ -635,16 +642,12 @@ VcsBaseEditorWidget::VcsBaseEditorWidget() ...@@ -635,16 +642,12 @@ VcsBaseEditorWidget::VcsBaseEditorWidget()
: d(new Internal::VcsBaseEditorWidgetPrivate(this)) : d(new Internal::VcsBaseEditorWidgetPrivate(this))
{ {
viewport()->setMouseTracking(true); viewport()->setMouseTracking(true);
BaseTextDocumentPtr doc(new BaseTextDocument);
setTextDocument(doc);
} }
void VcsBaseEditorWidget::setParameters(const VcsBaseEditorParameters *parameters) void VcsBaseEditorWidget::setParameters(const VcsBaseEditorParameters *parameters)
{ {
QTC_CHECK(d->m_parameters == 0); QTC_CHECK(d->m_parameters == 0);
d->m_parameters = parameters; d->m_parameters = parameters;
textDocument()->setId(d->m_parameters->id);
textDocument()->setMimeType(QLatin1String(d->m_parameters->mimeType));
} }
void VcsBaseEditorWidget::setDiffFilePattern(const QRegExp &pattern) void VcsBaseEditorWidget::setDiffFilePattern(const QRegExp &pattern)
...@@ -676,6 +679,27 @@ QString VcsBaseEditorWidget::fileNameForLine(int line) const ...@@ -676,6 +679,27 @@ QString VcsBaseEditorWidget::fileNameForLine(int line) const
return source(); return source();
} }
void VcsBaseEditorWidget::setDescribeSlot(QObject *describeReceiver, const char *describeSlot)
{
d->m_describeReceiver = describeReceiver;
d->m_describeSlot = describeSlot;
}
void VcsBaseEditorWidget::finalizeInitialization()
{
BaseTextEditor *editor = this->editor();
// Pass on signals.
connect(this, SIGNAL(describeRequested(QString,QString)),
editor, SIGNAL(describeRequested(QString,QString)));
connect(this, SIGNAL(annotateRevisionRequested(QString,QString,QString,int)),
editor, SIGNAL(annotateRevisionRequested(QString,QString,QString,int)));
if (d->m_describeReceiver)
connect(this, SIGNAL(describeRequested(QString,QString)), d->m_describeReceiver, d->m_describeSlot);
init();
}
void VcsBaseEditorWidget::init() void VcsBaseEditorWidget::init()
{ {
switch (d->m_parameters->type) { switch (d->m_parameters->type) {
...@@ -1550,38 +1574,32 @@ Core::IEditor *VcsBaseEditor::locateEditorByTag(const QString &tag) ...@@ -1550,38 +1574,32 @@ Core::IEditor *VcsBaseEditor::locateEditorByTag(const QString &tag)
#ifdef WITH_TESTS #ifdef WITH_TESTS
#include <QTest> #include <QTest>
// Tests need a fully set-up editor/widget combo. void VcsBase::VcsBaseEditorWidget::testDiffFileResolving(const char *id)
void VcsBase::VcsBaseEditorWidget::addDummyEditor()
{ {
BaseTextEditor *editor = new VcsBaseEditor(d->m_parameters); VcsBaseEditor *editor = VcsBase::VcsEditorFactory::createEditorById(id);
// Pass on signals. VcsBaseEditorWidget *widget = qobject_cast<VcsBaseEditorWidget *>(editor->editorWidget());
connect(this, SIGNAL(describeRequested(QString,QString)),
editor, SIGNAL(describeRequested(QString,QString)));
connect(this, SIGNAL(annotateRevisionRequested(QString,QString,QString,int)),
editor, SIGNAL(annotateRevisionRequested(QString,QString,QString,int)));
editor->setEditorWidget(this);
}
void VcsBase::VcsBaseEditorWidget::testDiffFileResolving()
{
addDummyEditor();
QFETCH(QByteArray, header); QFETCH(QByteArray, header);
QFETCH(QByteArray, fileName); QFETCH(QByteArray, fileName);
QTextDocument doc(QString::fromLatin1(header)); QTextDocument doc(QString::fromLatin1(header));
init();
QTextBlock block = doc.lastBlock(); QTextBlock block = doc.lastBlock();
QVERIFY(fileNameFromDiffSpecification(block).endsWith(QString::fromLatin1(fileName))); QVERIFY(widget->fileNameFromDiffSpecification(block).endsWith(QString::fromLatin1(fileName)));