mirror of
https://github.com/Murmele/Gittyup.git
synced 2024-09-11 02:35:41 +03:00
add test for conflicted files
This commit is contained in:
parent
fad1f45252
commit
774285d606
@ -30,6 +30,7 @@ private slots:
|
||||
void discardFiles();
|
||||
void fileMergeCrash();
|
||||
void dirtySubmoduleAndStagedSubmodule();
|
||||
void conflictedAndStagedFile();
|
||||
|
||||
private:
|
||||
};
|
||||
@ -267,7 +268,6 @@ void TestTreeView::dirtySubmoduleAndStagedSubmodule() {
|
||||
|
||||
auto doubleTree = repoView->findChild<DoubleTreeWidget *>();
|
||||
QVERIFY(doubleTree);
|
||||
doubleTree->fileCountExpansionThreshold = 5;
|
||||
auto stagedTree = doubleTree->findChild<TreeView *>("Staged");
|
||||
QVERIFY(stagedTree);
|
||||
auto unstagedTree = doubleTree->findChild<TreeView *>("Unstaged");
|
||||
@ -300,6 +300,43 @@ void TestTreeView::dirtySubmoduleAndStagedSubmodule() {
|
||||
}
|
||||
}
|
||||
|
||||
void TestTreeView::conflictedAndStagedFile() {
|
||||
INIT_REPO("ConflictedAndStagedFile.zip", false);
|
||||
|
||||
auto doubleTree = repoView->findChild<DoubleTreeWidget *>();
|
||||
QVERIFY(doubleTree);
|
||||
auto stagedTree = doubleTree->findChild<TreeView *>("Staged");
|
||||
QVERIFY(stagedTree);
|
||||
auto unstagedTree = doubleTree->findChild<TreeView *>("Unstaged");
|
||||
QVERIFY(unstagedTree);
|
||||
|
||||
{
|
||||
QAbstractItemModel *stagedModel = stagedTree->model();
|
||||
QCOMPARE(stagedModel->rowCount(), 1);
|
||||
QModelIndex index = stagedModel->index(0, 0); // "folder" folder
|
||||
QVERIFY(index.isValid());
|
||||
QCOMPARE(index.data(), "folder");
|
||||
|
||||
QCOMPARE(stagedModel->rowCount(index), 1);
|
||||
index = stagedModel->index(0, 0, index);
|
||||
QVERIFY(index.isValid());
|
||||
QCOMPARE(index.data(), "NotConflictedFile.txt");
|
||||
}
|
||||
|
||||
{
|
||||
QAbstractItemModel *unstagedModel = unstagedTree->model();
|
||||
QCOMPARE(unstagedModel->rowCount(), 1);
|
||||
QModelIndex index = unstagedModel->index(0, 0); // "folder" folder
|
||||
QVERIFY(index.isValid());
|
||||
QCOMPARE(index.data(), "folder");
|
||||
|
||||
QCOMPARE(unstagedModel->rowCount(index), 1);
|
||||
index = unstagedModel->index(0, 0, index);
|
||||
QVERIFY(index.isValid());
|
||||
QCOMPARE(index.data(), "conflictedFile.txt");
|
||||
}
|
||||
}
|
||||
|
||||
TEST_MAIN(TestTreeView)
|
||||
|
||||
#include "TreeView.moc"
|
||||
|
BIN
test/testRepos/ConflictedAndStagedFile.zip
Normal file
BIN
test/testRepos/ConflictedAndStagedFile.zip
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user