2018-12-13 02:22:04 +03:00
|
|
|
//
|
|
|
|
// 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: Jason Haslam
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef TEST_H
|
|
|
|
#define TEST_H
|
|
|
|
|
|
|
|
#include "app/Application.h"
|
|
|
|
#include "git/Repository.h"
|
|
|
|
#include <QTemporaryDir>
|
|
|
|
#include <QtTest/QtTest>
|
|
|
|
|
|
|
|
#define TEST_MAIN(TestClass) \
|
|
|
|
int main(int argc, char *argv[]) \
|
|
|
|
{ \
|
2021-11-26 17:25:46 +03:00
|
|
|
int orig_argc = argc;\
|
|
|
|
Application app = Test::createApp(argc, argv); \
|
2018-12-13 02:22:04 +03:00
|
|
|
TestClass test; \
|
|
|
|
QTEST_SET_MAIN_SOURCE_PATH \
|
2021-11-26 17:25:46 +03:00
|
|
|
return QTest::qExec(&test, orig_argc, argv); \
|
2018-12-13 02:22:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
class RepoView;
|
|
|
|
|
|
|
|
namespace Test {
|
|
|
|
|
|
|
|
class ScratchRepository
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ScratchRepository(bool autoRemove = true);
|
|
|
|
|
|
|
|
// Treat this class a wrapper.
|
|
|
|
operator git::Repository();
|
|
|
|
git::Repository *operator->();
|
|
|
|
|
|
|
|
private:
|
|
|
|
QTemporaryDir mDir;
|
|
|
|
git::Repository mRepo;
|
|
|
|
};
|
|
|
|
|
|
|
|
void refresh(RepoView *repoView, bool expectDirty = true);
|
|
|
|
void fetch(RepoView *repoView, git::Remote remote);
|
2022-02-02 20:53:53 +03:00
|
|
|
QString extractRepository(const QString &filename, bool useTempDir);
|
2018-12-13 02:22:04 +03:00
|
|
|
|
2021-11-26 17:25:46 +03:00
|
|
|
Application createApp(int &argc, char *argv[]);
|
|
|
|
|
2018-12-13 02:22:04 +03:00
|
|
|
} // namespace Test
|
|
|
|
|
|
|
|
#endif
|