diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2018-01-16 22:45:10 +0200 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2018-01-17 09:13:29 +0000 |
commit | b8ee51fef170e221d8370c211760db45c23773a6 (patch) | |
tree | a308ac6a2b7c61e092d7162e4ed7d8a85a2836ff /src/plugins/diffeditor/diffeditorplugin.cpp | |
parent | cb97b2ee97a8fddbd94699ebfdf32d2127948aa4 (diff) | |
download | qt-creator-b8ee51fef170e221d8370c211760db45c23773a6.tar.gz |
DiffEditor: Simplify makePatch tests a bit
Change-Id: I205bda692dbb5f759ca84dd5cf4b73da9601a7b5
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/diffeditor/diffeditorplugin.cpp')
-rw-r--r-- | src/plugins/diffeditor/diffeditorplugin.cpp | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/src/plugins/diffeditor/diffeditorplugin.cpp b/src/plugins/diffeditor/diffeditorplugin.cpp index 6d6aa0715c..c3bfbdb094 100644 --- a/src/plugins/diffeditor/diffeditorplugin.cpp +++ b/src/plugins/diffeditor/diffeditorplugin.cpp @@ -618,8 +618,6 @@ static inline QString _(const char *string) { return QString::fromLatin1(string) void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() { QTest::addColumn<ChunkData>("sourceChunk"); - QTest::addColumn<QString>("leftFileName"); - QTest::addColumn<QString>("rightFileName"); QTest::addColumn<bool>("lastChunk"); QTest::addColumn<QString>("patchText"); @@ -635,8 +633,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "-ABCD\n" " EFGH\n"; QTest::newRow("Simple not a last chunk") << chunk - << fileName - << fileName << false << patchText; @@ -649,8 +645,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "\\ No newline at end of file\n"; QTest::newRow("Simple last chunk") << chunk - << fileName - << fileName << true << patchText; @@ -666,8 +660,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "\\ No newline at end of file\n"; QTest::newRow("EOL in last line removed") << chunk - << fileName - << fileName << true << patchText; @@ -679,8 +671,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "-\n"; QTest::newRow("Last empty line removed") << chunk - << fileName - << fileName << false << patchText; @@ -698,8 +688,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "\\ No newline at end of file\n"; QTest::newRow("Two last EOLs removed") << chunk - << fileName - << fileName << true << patchText; @@ -715,8 +703,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "+ABCD\n"; QTest::newRow("EOL to last line added") << chunk - << fileName - << fileName << true << patchText; @@ -728,8 +714,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "+\n"; QTest::newRow("Last empty line added") << chunk - << fileName - << fileName << false << patchText; @@ -743,8 +727,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "+EFGH\n"; QTest::newRow("Last line with a newline modified") << chunk - << fileName - << fileName << false << patchText; @@ -759,8 +741,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "+EFGH\n" " \n"; QTest::newRow("Not a last line with a newline modified") << chunk - << fileName - << fileName << false << patchText; @@ -776,8 +756,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "\\ No newline at end of file\n"; QTest::newRow("Last line without a newline modified") << chunk - << fileName - << fileName << true << patchText; @@ -788,8 +766,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() "-ABCD\n" "+EFGH\n"; QTest::newRow("Not a last line without a newline modified") << chunk - << fileName - << fileName << false << patchText; @@ -807,8 +783,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() QTest::newRow("Last but one line modified, last line without a newline") << chunk - << fileName - << fileName << true << patchText; @@ -822,8 +796,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() QTest::newRow("Last but one line modified, last line with a newline") << chunk - << fileName - << fileName << false << patchText; @@ -842,8 +814,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() QTest::newRow("Blank line followed by No newline") << chunk - << fileName - << fileName << true << patchText; } @@ -851,12 +821,11 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch_data() void DiffEditor::Internal::DiffEditorPlugin::testMakePatch() { QFETCH(ChunkData, sourceChunk); - QFETCH(QString, leftFileName); - QFETCH(QString, rightFileName); QFETCH(bool, lastChunk); QFETCH(QString, patchText); - const QString result = DiffUtils::makePatch(sourceChunk, leftFileName, rightFileName, lastChunk); + const QString fileName = "a.txt"; + const QString result = DiffUtils::makePatch(sourceChunk, fileName, fileName, lastChunk); QCOMPARE(result, patchText); @@ -867,8 +836,8 @@ void DiffEditor::Internal::DiffEditorPlugin::testMakePatch() QCOMPARE(resultList.count(), 1); for (int i = 0; i < resultList.count(); i++) { const FileData &resultFileData = resultList.at(i); - QCOMPARE(resultFileData.leftFileInfo.fileName, leftFileName); - QCOMPARE(resultFileData.rightFileInfo.fileName, rightFileName); + QCOMPARE(resultFileData.leftFileInfo.fileName, fileName); + QCOMPARE(resultFileData.rightFileInfo.fileName, fileName); QCOMPARE(resultFileData.chunks.count(), 1); for (int j = 0; j < resultFileData.chunks.count(); j++) { const ChunkData &resultChunkData = resultFileData.chunks.at(j); |