aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-07-20 13:06:17 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2020-07-21 10:13:43 +0000
commitc41847ce5da4f40754f7ed90c3ad3d7db018d94a (patch)
tree973eea5b1c16aebf0780aa555085e0d77c1aaa45 /src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
parent45dd017853fa96f91e02a0bb3266bb8aaf47a20a (diff)
CppEditor: Find implementations for pure virtual declaration
Clearly, if a user presses F2 on the declaration of an (unimplemented) pure virtual function, they want to go to an implementation in a derived class. Fixes: QTCREATORBUG-10160 Change-Id: Ie8c4ff0001ab2c98a2d0e2ebc8d954cc928578c0 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp')
-rw-r--r--src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
index 1355b2d178..17f2e364f9 100644
--- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
+++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp
@@ -1413,6 +1413,31 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_virtualFunctionCall_data()
<< OverrideItem(QLatin1String("CD1::virt"), 11)
<< OverrideItem(QLatin1String("CD2::virt"), 14));
+ /// Check: Cursor on unimplemented base declaration.
+ QTest::newRow("allOverrides from base declaration") << _(
+ "struct A { virtual void $@virt() = 0; };\n"
+ "\n"
+ "struct B : A { void virt(); };\n"
+ "void B::virt() {}\n"
+ "\n"
+ "struct C : B { void virt(); };\n"
+ "void C::virt() {}\n"
+ "\n"
+ "struct CD1 : C { void virt(); };\n"
+ "void CD1::virt() {}\n"
+ "\n"
+ "struct CD2 : C { void virt(); };\n"
+ "void CD2::virt() {}\n"
+ "\n"
+ "int f(A *o) { o->virt(); }\n"
+ "\n")
+ << (OverrideItemList()
+ << OverrideItem(QLatin1String("A::virt = 0"), 1)
+ << OverrideItem(QLatin1String("B::virt"), 4)
+ << OverrideItem(QLatin1String("C::virt"), 7)
+ << OverrideItem(QLatin1String("CD1::virt"), 10)
+ << OverrideItem(QLatin1String("CD2::virt"), 13));
+
/// Check: Static type is derived class pointer, only overrides of sub classes are presented.
QTest::newRow("possibleOverrides1") << _(
"struct A { virtual void virt() = 0; };\n"