Changeset View
Changeset View
Standalone View
Standalone View
plugins/perforce/tests/test_perforce.cpp
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | |||||
42 | 42 | | |||
43 | const QString perforceSrcDir(perforceTestBaseDir + "src/"); | 43 | const QString perforceSrcDir(perforceTestBaseDir + "src/"); | ||
44 | const QString perforceTest_FileName(QStringLiteral("testfile")); | 44 | const QString perforceTest_FileName(QStringLiteral("testfile")); | ||
45 | const QString perforceTest_FileName2(QStringLiteral("foo")); | 45 | const QString perforceTest_FileName2(QStringLiteral("foo")); | ||
46 | const QString perforceTest_FileName3(QStringLiteral("bar")); | 46 | const QString perforceTest_FileName3(QStringLiteral("bar")); | ||
47 | 47 | | |||
48 | using namespace KDevelop; | 48 | using namespace KDevelop; | ||
49 | 49 | | |||
50 | void PerforcePluginTest::initTestCase() | ||||
51 | { | ||||
52 | AutoTestShell::init({QStringLiteral("kdevperforce")}); | ||||
53 | TestCore::initialize(); | ||||
54 | m_plugin = new PerforcePlugin(TestCore::self()); | ||||
55 | } | ||||
56 | | ||||
57 | void PerforcePluginTest::cleanupTestCase() | ||||
58 | { | ||||
59 | delete m_plugin; | ||||
60 | TestCore::shutdown(); | ||||
61 | } | ||||
62 | | ||||
63 | | ||||
50 | void PerforcePluginTest::init() | 64 | void PerforcePluginTest::init() | ||
51 | { | 65 | { | ||
52 | AutoTestShell::init({"kdevperforce"}); | | |||
53 | m_core = new TestCore(); | | |||
54 | m_core->initialize(); | | |||
55 | m_plugin = new PerforcePlugin(m_core); | | |||
56 | /// During test we are setting the executable the plugin uses to our own stub | 66 | /// During test we are setting the executable the plugin uses to our own stub | ||
57 | m_plugin->m_perforceExecutable = P4_CLIENT_STUB_EXE; | 67 | m_plugin->m_perforceExecutable = P4_CLIENT_STUB_EXE; | ||
58 | removeTempDirsIfAny(); | 68 | removeTempDirsIfAny(); | ||
59 | createNewTempDirs(); | 69 | createNewTempDirs(); | ||
60 | } | 70 | } | ||
61 | 71 | | |||
62 | void PerforcePluginTest::createNewTempDirs() | 72 | void PerforcePluginTest::createNewTempDirs() | ||
63 | { | 73 | { | ||
Show All 33 Lines | 102 | { | |||
97 | QDir dir2(perforceTestBaseDir); | 107 | QDir dir2(perforceTestBaseDir); | ||
98 | if (dir2.exists() && !dir2.removeRecursively()) | 108 | if (dir2.exists() && !dir2.removeRecursively()) | ||
99 | qDebug() << "QDir::removeRecursively(" << perforceTestBaseDir2 << ") returned false"; | 109 | qDebug() << "QDir::removeRecursively(" << perforceTestBaseDir2 << ") returned false"; | ||
100 | } | 110 | } | ||
101 | 111 | | |||
102 | 112 | | |||
103 | void PerforcePluginTest::cleanup() | 113 | void PerforcePluginTest::cleanup() | ||
104 | { | 114 | { | ||
105 | m_core->cleanup(); | | |||
106 | delete m_core; | | |||
107 | removeTempDirsIfAny(); | 115 | removeTempDirsIfAny(); | ||
108 | } | 116 | } | ||
109 | 117 | | |||
110 | void PerforcePluginTest::testAdd() | 118 | void PerforcePluginTest::testAdd() | ||
111 | { | 119 | { | ||
112 | VcsJob* j = m_plugin->add(QList<QUrl>({ QUrl::fromLocalFile(perforceTestBaseDir + perforceTest_FileName) } )); | 120 | VcsJob* j = m_plugin->add(QList<QUrl>({ QUrl::fromLocalFile(perforceTestBaseDir + perforceTest_FileName) } )); | ||
113 | VERIFYJOB(j); | 121 | VERIFYJOB(j); | ||
114 | } | 122 | } | ||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |