// // Copyright (c) 2016, Scientific Toolworks, Inc. // // This software is licensed under the MIT License. The LICENSE.md file // describes the conditions under which this software may be distributed. // // Author: Shane Gramlich // #include "Test.h" #include "dialogs/ConfigDialog.h" #include "ui/Footer.h" #include "ui/MainWindow.h" #include "ui/RepoView.h" #include #include #include #include #include #include #include using namespace Test; using namespace QTest; class TestBranchesPanel : public QObject { Q_OBJECT private slots: void initTestCase(); void createBranch(); void cleanupTestCase(); private: int inputDelay = 0; int closeDelay = 0; ScratchRepository mRepo; MainWindow *mWindow = nullptr; ConfigDialog *mConfigDialog = nullptr; }; void TestBranchesPanel::initTestCase() { mWindow = new MainWindow(mRepo); RepoView *view = mWindow->currentView(); QString repoPath = Test::extractRepository("gitahead-test.zip", false); git::Remote remote = mRepo->addRemote("origin", repoPath); fetch(view, remote); git::Branch upstream = mRepo->lookupBranch("origin/master", GIT_BRANCH_REMOTE); QVERIFY(upstream.isValid()); git::Branch branch = view->createBranch("master", upstream.target(), upstream, true); QVERIFY(branch.isValid()); mWindow->show(); mConfigDialog = view->configureSettings(ConfigDialog::Branches); QVERIFY(qWaitForWindowExposed(mConfigDialog)); } void TestBranchesPanel::createBranch() { QStackedWidget *stack = mConfigDialog->findChild(); QVERIFY(stack); // Click add branch icon QWidget *panel = stack->currentWidget(); Footer *remotesFooter = panel->findChild