Seed the random number generator before using QTemporaryDir
Otherwise, on some systems (Windows), we'll always create the same dirs. Change-Id: Id3d5c7bf4d4c45069621ffff13f79ba91e0f974b Reviewed-by: Christopher Adams <chris.adams@jollamobile.com>
This commit is contained in:
parent
4067bbc24c
commit
5f1a0cb42a
@ -144,12 +144,18 @@ inline bool qIsLikelyToBeNfs(int /* handle */)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static QString seedAndTemplate()
|
||||
{
|
||||
qsrand(QDateTime::currentDateTimeUtc().toTime_t());
|
||||
return QDir::tempPath() + "/tst_qfileinfo-XXXXXX";
|
||||
}
|
||||
class tst_QFileInfo : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
tst_QFileInfo() : m_currentDir(QDir::currentPath()) {}
|
||||
tst_QFileInfo() : m_currentDir(QDir::currentPath()), m_dir(seedAndTemplate())
|
||||
{}
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
|
@ -103,7 +103,14 @@ static bool copyResourceFile(const QString &sourceFileName, const QString &targe
|
||||
// Set LANG before QCoreApplication is created
|
||||
Q_CONSTRUCTOR_FUNCTION(initializeLang)
|
||||
|
||||
static QString seedAndTemplate()
|
||||
{
|
||||
qsrand(QDateTime::currentDateTimeUtc().toTime_t());
|
||||
return QDir::tempPath() + "/tst_qmimedatabase-XXXXXX";
|
||||
}
|
||||
|
||||
tst_QMimeDatabase::tst_QMimeDatabase()
|
||||
: m_temporaryDir(seedAndTemplate())
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user