forked from qt-creator/qt-creator
CppEditor: Introduce central function for registering quickfixes
... and use it to register the InsertVirtualMethods quickfix. The resulting registration pattern encourages the presence of tests and easily allows minimal visibility of the classes involved. Change-Id: I85fba0b983b51d84b6fae1f6fe51b63eed0ee336 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -116,6 +116,11 @@ public:
|
||||
QSortFilterProxyModel *classFunctionFilterModel;
|
||||
};
|
||||
|
||||
void registerInsertVirtualMethodsQuickfix()
|
||||
{
|
||||
CppQuickFixFactory::registerFactory<InsertVirtualMethods>();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CppEditor
|
||||
|
||||
@@ -1269,6 +1274,17 @@ public:
|
||||
void saveSettings() override { }
|
||||
};
|
||||
|
||||
class InsertVirtualMethodsTest : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void test_data();
|
||||
void test();
|
||||
void testImplementationFile();
|
||||
void testBaseClassInNamespace();
|
||||
};
|
||||
|
||||
void InsertVirtualMethodsTest::test_data()
|
||||
{
|
||||
QTest::addColumn<InsertVirtualMethodsDialog::ImplementationMode>("implementationMode");
|
||||
@@ -1969,6 +1985,11 @@ InsertVirtualMethods *InsertVirtualMethods::createTestFactory()
|
||||
InsertVirtualMethodsDialog::ModeOutsideClass, true, false));
|
||||
}
|
||||
|
||||
QObject *InsertVirtualMethods::createTest()
|
||||
{
|
||||
return new Tests::InsertVirtualMethodsTest;
|
||||
}
|
||||
|
||||
#endif // WITH_TESTS
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user