gui/test: Extract temporary file creation to a separate file
This commit is contained in:
parent
7f76d3cdcc
commit
e7da893f5a
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
|
||||
#include "../src/KeySequence.h"
|
||||
#include "Utils.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include <cstdio>
|
||||
|
||||
|
@ -73,14 +74,7 @@ namespace {
|
|||
Qt::Key_Launch1,
|
||||
Qt::Key_Select,
|
||||
};
|
||||
|
||||
QString getTemporaryFilename()
|
||||
{
|
||||
QTemporaryFile temp_file;
|
||||
temp_file.open();
|
||||
return temp_file.fileName();
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
class KeySequenceLoadSaveTestFixture :
|
||||
public ::testing::TestWithParam<std::tr1::tuple<Qt::Key, QSettings::Format>> {};
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/* barrier -- mouse and keyboard sharing utility
|
||||
Copyright (C) 2021 Povilas Kanapickas <povilas@radix.lt>
|
||||
|
||||
This package is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
found in the file LICENSE that should have accompanied this file.
|
||||
|
||||
This package is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef BARRIER_GUI_TEST_UTILS_H
|
||||
#define BARRIER_GUI_TEST_UTILS_H
|
||||
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QTemporaryFile>
|
||||
|
||||
inline QString getTemporaryFilename()
|
||||
{
|
||||
QTemporaryFile temp_file;
|
||||
temp_file.open();
|
||||
return temp_file.fileName();
|
||||
}
|
||||
|
||||
#endif // BARRIER_GUI_TEST_UTILS_H
|
Loading…
Reference in New Issue