add additional tests

This commit is contained in:
Martin Marmsoler 2022-10-07 08:12:08 +02:00
parent 2796e5416a
commit f415020282
3 changed files with 35 additions and 3 deletions

View File

@ -112,8 +112,11 @@ private slots:
void windowsCRLF();
#endif // Q_OS_WIN
#endif // EXECUTE_ONLY_LAST_TEST == 0
void windowsCRLFMultiHunk();
#endif // EXECUTE_ONLY_LAST_TEST == 0
void sameContentRemoveLine();
void sameContentAddLine();
private:
int closeDelay = 0;
@ -854,8 +857,6 @@ void TestEditorLineInfo::windowsCRLF() {
}
#endif // Q_OS_WIN
#endif
void TestEditorLineInfo::windowsCRLFMultiHunk() {
/*
* Staging single lines in a file with CRLF instead of single LF for multiple
@ -917,6 +918,37 @@ void TestEditorLineInfo::windowsCRLFMultiHunk() {
}
}
#endif
void TestEditorLineInfo::sameContentRemoveLine() {
INIT_REPO("16_LinestagingLineContent.zip", true)
QVERIFY(stagedDiff.count() > 0);
QVERIFY(diff.count() > 0);
git::Patch patch = diff.patch(0);
git::Patch stagedPatch = stagedDiff.patch(0);
auto hw = HunkWidget(&diffView, diff, patch, stagedPatch, 0, false, false,
repoView);
hw.load(stagedPatch, true);
checkEditorMarkers(hw.editor(), QVector<int>({3, 4, 5, 12, 13, 21, 22}),
QVector<int>(), QVector<int>({11, 19, 20}),
QVector<int>({10}));
}
void TestEditorLineInfo::sameContentAddLine() {
INIT_REPO("17_LinestagingLineContentStageAddedLine.zip", true)
QVERIFY(stagedDiff.count() > 0);
QVERIFY(diff.count() > 0);
git::Patch patch = diff.patch(0);
git::Patch stagedPatch = stagedDiff.patch(0);
auto hw = HunkWidget(&diffView, diff, patch, stagedPatch, 0, false, false,
repoView);
hw.load(stagedPatch, true);
checkEditorMarkers(hw.editor(), QVector<int>({3, 4}), QVector<int>({9}),
QVector<int>({}), QVector<int>({}));
}
void TestEditorLineInfo::cleanupTestCase() { qWait(closeDelay); }
TEST_MAIN(TestEditorLineInfo)

Binary file not shown.