Git: Add auto tests for CloneWizardPage

Change-Id: I6b186731eba56a70ce799f17fdf538bb674a5439
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Andre Hartmann
2014-07-11 23:15:01 +02:00
committed by André Hartmann
parent 1f1eb5e4ba
commit c30856e657
4 changed files with 39 additions and 0 deletions

View File

@@ -154,3 +154,16 @@ QStringList CloneWizardPage::branches(const QString &repository, int *current)
}
} // 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

View File

@@ -54,6 +54,11 @@ protected:
QString directoryFromRepository(const QString &r) const;
QStringList branches(const QString &repository, int *current);
#ifdef WITH_TESTS
public:
void testDirectoryFromRepository();
#endif
private:
CloneWizardPagePrivate *d;
};

View File

@@ -1487,6 +1487,8 @@ Gerrit::Internal::GerritPlugin *GitPlugin::gerritPlugin() const
#ifdef WITH_TESTS
#include "clonewizardpage.h"
#include <QTest>
Q_DECLARE_METATYPE(FileStates)
@@ -1602,6 +1604,23 @@ void GitPlugin::testLogResolving()
"50a6b54c - Merge branch 'for-junio' of git://bogomips.org/git-svn",
"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
Q_EXPORT_PLUGIN(GitPlugin)

View File

@@ -149,6 +149,8 @@ private slots:
void testDiffFileResolving_data();
void testDiffFileResolving();
void testLogResolving();
void testCloneWizard_directoryFromRepository();
void testCloneWizard_directoryFromRepository_data();
#endif
protected:
void updateActions(VcsBase::VcsBasePlugin::ActionState);