CppEditor: Fix some "convert to camel case" edge cases

Fixes: QTCREATORBUG-16560
Change-Id: I8573ae6c5dce0956c868addc69a921c62f1d571a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2020-10-16 16:38:25 +02:00
parent 675a85bef0
commit 2b5e1ea62e
5 changed files with 76 additions and 20 deletions

View File

@@ -2047,6 +2047,39 @@ void CppEditorPlugin::test_quickfix_data()
<< CppQuickFixFactoryPtr(new InsertQtPropertyMembers)
<< _("class C { @Q_PROPERTY(typeid foo READ foo) };\n")
<< _();
QTest::newRow("convert to camel case: normal")
<< CppQuickFixFactoryPtr(new ConvertToCamelCase(true))
<< _("void @lower_case_function();\n")
<< _("void lowerCaseFunction();\n");
QTest::newRow("convert to camel case: already camel case")
<< CppQuickFixFactoryPtr(new ConvertToCamelCase(true))
<< _("void @camelCaseFunction();\n")
<< _();
QTest::newRow("convert to camel case: no underscores (lower case)")
<< CppQuickFixFactoryPtr(new ConvertToCamelCase(true))
<< _("void @lowercasefunction();\n")
<< _();
QTest::newRow("convert to camel case: no underscores (upper case)")
<< CppQuickFixFactoryPtr(new ConvertToCamelCase(true))
<< _("void @UPPERCASEFUNCTION();\n")
<< _();
QTest::newRow("convert to camel case: non-applicable underscore")
<< CppQuickFixFactoryPtr(new ConvertToCamelCase(true))
<< _("void @m_a_member;\n")
<< _("void m_aMember;\n");
QTest::newRow("convert to camel case: upper case")
<< CppQuickFixFactoryPtr(new ConvertToCamelCase(true))
<< _("void @UPPER_CASE_FUNCTION();\n")
<< _("void upperCaseFunction();\n");
QTest::newRow("convert to camel case: partially camel case already")
<< CppQuickFixFactoryPtr(new ConvertToCamelCase(true))
<< _("void mixed@_andCamelCase();\n")
<< _("void mixedAndCamelCase();\n");
QTest::newRow("convert to camel case: wild mix")
<< CppQuickFixFactoryPtr(new ConvertToCamelCase(true))
<< _("void @WhAt_TODO_hErE();\n")
<< _("void WhAtTODOHErE();\n");
}
void CppEditorPlugin::test_quickfix()