From b865c6e57ec2ce677cde350c091dc32ab1bdb4aa Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@digia.com> Date: Thu, 12 Sep 2013 17:10:33 +0200 Subject: [PATCH] CppEditor: more autotests for follow under cursor Add autotests for follow under cursor for constructors and destructors. Task-number: QTCREATORBUG-7485 Change-Id: I43cc12f54b93a582203cd52c1fd61fedf9198e74 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com> --- src/plugins/cppeditor/cppeditorplugin.h | 2 ++ .../followsymbol_switchmethoddecldef_test.cpp | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/src/plugins/cppeditor/cppeditorplugin.h b/src/plugins/cppeditor/cppeditorplugin.h index ea117673c85..cbb34643a6d 100644 --- a/src/plugins/cppeditor/cppeditorplugin.h +++ b/src/plugins/cppeditor/cppeditorplugin.h @@ -119,6 +119,8 @@ private slots: void test_FollowSymbolUnderCursor_baseClassFunctionIntroducedByUsingDeclaration(); void test_FollowSymbolUnderCursor_funWithSameNameAsBaseClassFunIntroducedByUsingDeclaration(); void test_FollowSymbolUnderCursor_funLocalVarHidesOuterClass(); + void test_FollowSymbolUnderCursor_classConstructor(); + void test_FollowSymbolUnderCursor_classDestructor(); void test_FollowSymbolUnderCursor_using_QTCREATORBUG7903_globalNamespace(); void test_FollowSymbolUnderCursor_using_QTCREATORBUG7903_namespace(); void test_FollowSymbolUnderCursor_using_QTCREATORBUG7903_insideFunction(); diff --git a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp index dae9e0aaccd..5d541e49e20 100644 --- a/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp +++ b/src/plugins/cppeditor/followsymbol_switchmethoddecldef_test.cpp @@ -862,6 +862,42 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_funLocalVarHidesOuterClass() test.run(); } +void CppEditorPlugin::test_FollowSymbolUnderCursor_classConstructor() +{ + const QByteArray source = + "class Foo {\n" + " F@oo();" + " ~Foo();" + "};\n\n" + "Foo::$Foo()\n" + "{\n" + "}\n\n" + "Foo::~Foo()\n" + "{\n" + "}\n"; + + TestCase test(TestCase::FollowSymbolUnderCursor, source); + test.run(); +} + +void CppEditorPlugin::test_FollowSymbolUnderCursor_classDestructor() +{ + const QByteArray source = + "class Foo {\n" + " Foo();" + " ~@Foo();" + "};\n\n" + "Foo::Foo()\n" + "{\n" + "}\n\n" + "Foo::~$Foo()\n" + "{\n" + "}\n"; + + TestCase test(TestCase::FollowSymbolUnderCursor, source); + test.run(); +} + void CppEditorPlugin::test_FollowSymbolUnderCursor_using_QTCREATORBUG7903_globalNamespace() { const QByteArray source = -- GitLab