File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change 1
1
#include " cucumber-cpp/internal/drivers/QtTestDriver.hpp"
2
2
3
- #include < QtTest/QtTest>
4
- #include < QTextStream>
5
3
#include < QTemporaryFile>
4
+ #include < QTextStream>
5
+ #include < QtTest/QtTest>
6
6
7
7
namespace cucumber {
8
8
namespace internal {
9
9
10
-
11
- // wraps the QTemporaryFile creation
12
- // on Windows the file could not be written as long as QTemporaryFile owner of the file.
10
+ /* *
11
+ * Wraps the QTemporaryFile creation
12
+ *
13
+ * On Windows the file could not be written as long as QTemporaryFile owner of the file.
14
+ */
13
15
class TemporaryFileWrapper {
14
16
public:
15
- static TemporaryFileWrapper create ()
16
- {
17
+ static TemporaryFileWrapper create () {
17
18
QTemporaryFile tempFile{};
18
19
19
- if (!tempFile.open ()) {
20
+ if (!tempFile.open ()) {
20
21
return {};
21
22
}
22
23
23
24
return {tempFile.fileName () + " .txt" };
24
25
}
25
26
26
- TemporaryFileWrapper (): filename{} {
27
+ TemporaryFileWrapper () :
28
+ filename{} {
27
29
}
28
30
29
- TemporaryFileWrapper (QString filename): filename{filename} {
31
+ TemporaryFileWrapper (QString filename) :
32
+ filename{filename} {
30
33
}
31
34
32
35
~TemporaryFileWrapper () {
33
36
QFile::remove (filename);
34
37
}
35
38
36
- bool exists () const { return !filename.isEmpty (); }
39
+ bool exists () const {
40
+ return !filename.isEmpty ();
41
+ }
37
42
38
43
QString name () const {
39
44
return filename;
40
45
}
41
46
42
47
QString read () const {
43
- QFile file{ filename };
48
+ QFile file{filename};
44
49
if (!file.open (QIODevice::ReadOnly | QIODevice::Text))
45
50
return QString ();
46
51
QTextStream in (&file);
You can’t perform that action at this time.
0 commit comments