forked from qt-creator/qt-creator
Git: Add auto tests for CloneWizardPage
Change-Id: I6b186731eba56a70ce799f17fdf538bb674a5439 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
André Hartmann
parent
1f1eb5e4ba
commit
c30856e657
@@ -154,3 +154,16 @@ QStringList CloneWizardPage::branches(const QString &repository, int *current)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Git
|
} // namespace Git
|
||||||
|
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
#include <QTest>
|
||||||
|
|
||||||
|
void Git::CloneWizardPage::testDirectoryFromRepository()
|
||||||
|
{
|
||||||
|
QFETCH(QString, repository);
|
||||||
|
QFETCH(QString, localDirectory);
|
||||||
|
|
||||||
|
QEXPECT_FAIL("ssh with port", "QTCREATORBUG-12651", Abort);
|
||||||
|
QCOMPARE(directoryFromRepository(repository), localDirectory);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -54,6 +54,11 @@ protected:
|
|||||||
QString directoryFromRepository(const QString &r) const;
|
QString directoryFromRepository(const QString &r) const;
|
||||||
QStringList branches(const QString &repository, int *current);
|
QStringList branches(const QString &repository, int *current);
|
||||||
|
|
||||||
|
#ifdef WITH_TESTS
|
||||||
|
public:
|
||||||
|
void testDirectoryFromRepository();
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CloneWizardPagePrivate *d;
|
CloneWizardPagePrivate *d;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1487,6 +1487,8 @@ Gerrit::Internal::GerritPlugin *GitPlugin::gerritPlugin() const
|
|||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
|
|
||||||
|
#include "clonewizardpage.h"
|
||||||
|
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(FileStates)
|
Q_DECLARE_METATYPE(FileStates)
|
||||||
@@ -1602,6 +1604,23 @@ void GitPlugin::testLogResolving()
|
|||||||
"50a6b54c - Merge branch 'for-junio' of git://bogomips.org/git-svn",
|
"50a6b54c - Merge branch 'for-junio' of git://bogomips.org/git-svn",
|
||||||
"3587b513 - Update draft release notes to 1.8.2");
|
"3587b513 - Update draft release notes to 1.8.2");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GitPlugin::testCloneWizard_directoryFromRepository()
|
||||||
|
{
|
||||||
|
CloneWizardPage page;
|
||||||
|
page.testDirectoryFromRepository();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GitPlugin::testCloneWizard_directoryFromRepository_data()
|
||||||
|
{
|
||||||
|
QTest::addColumn<QString>("repository");
|
||||||
|
QTest::addColumn<QString>("localDirectory");
|
||||||
|
|
||||||
|
QTest::newRow("http") << "http://host/qt/qt.git" << "qt";
|
||||||
|
QTest::newRow("user@host") << "user@host:qt/qt.git" << "qt";
|
||||||
|
QTest::newRow("local repo") << "/home/user/qt-creator.git" << "home-user-qt-creator";
|
||||||
|
QTest::newRow("ssh with port") << "ssh://host:29418/qt/qt.git" << "qt";
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN(GitPlugin)
|
Q_EXPORT_PLUGIN(GitPlugin)
|
||||||
|
|||||||
@@ -149,6 +149,8 @@ private slots:
|
|||||||
void testDiffFileResolving_data();
|
void testDiffFileResolving_data();
|
||||||
void testDiffFileResolving();
|
void testDiffFileResolving();
|
||||||
void testLogResolving();
|
void testLogResolving();
|
||||||
|
void testCloneWizard_directoryFromRepository();
|
||||||
|
void testCloneWizard_directoryFromRepository_data();
|
||||||
#endif
|
#endif
|
||||||
protected:
|
protected:
|
||||||
void updateActions(VcsBase::VcsBasePlugin::ActionState);
|
void updateActions(VcsBase::VcsBasePlugin::ActionState);
|
||||||
|
|||||||
Reference in New Issue
Block a user