blob: c47e1409142afcd6071acf68572d842d4276d434 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "test-utilities.h"
#include <utils/temporarydirectory.h>
class Environment : public testing::Environment
{
public:
void SetUp() override
{
const QString temporayDirectoryPath = QDir::tempPath() + "/QtCreator-UnitTests-XXXXXX";
Utils::TemporaryDirectory::setMasterTemporaryDirectory(temporayDirectoryPath);
qputenv("TMPDIR", Utils::TemporaryDirectory::masterDirectoryPath().toUtf8());
qputenv("TEMP", Utils::TemporaryDirectory::masterDirectoryPath().toUtf8());
}
void TearDown() override {}
};
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
auto environment = std::make_unique<Environment>();
testing::AddGlobalTestEnvironment(environment.release());
return RUN_ALL_TESTS();
}
|