tst_qfiledialog: use QStandardPaths test mode
Otherwise, when interrupting the test half-way (e.g. in gdb), the user's ~/.config/QtProject.conf would be modified. Change-Id: Id582c4a3fbf0acbed460126fccf0d39b3a09758a Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
parent
c99dfd8f63
commit
c2cc74f862
@ -114,8 +114,8 @@ public:
|
|||||||
virtual ~tst_QFiledialog();
|
virtual ~tst_QFiledialog();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void initTestCase();
|
||||||
void init();
|
void init();
|
||||||
void cleanup();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void currentChangedSignal();
|
void currentChangedSignal();
|
||||||
@ -185,28 +185,25 @@ tst_QFiledialog::~tst_QFiledialog()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_QFiledialog::initTestCase()
|
||||||
|
{
|
||||||
|
QStandardPaths::setTestModeEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
void tst_QFiledialog::init()
|
void tst_QFiledialog::init()
|
||||||
{
|
{
|
||||||
// Save the developers settings so they don't get mad when their sidebar folders are gone.
|
// clean up the sidebar between each test
|
||||||
QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
|
QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
|
||||||
settings.beginGroup(QLatin1String("Qt"));
|
settings.beginGroup(QLatin1String("Qt"));
|
||||||
userSettings = settings.value(QLatin1String("filedialog")).toByteArray();
|
|
||||||
settings.remove(QLatin1String("filedialog"));
|
settings.remove(QLatin1String("filedialog"));
|
||||||
|
|
||||||
// populate it with some default settings
|
// populate the sidebar with some default settings
|
||||||
QNonNativeFileDialog fd;
|
QNonNativeFileDialog fd;
|
||||||
#if defined(Q_OS_WINCE)
|
#if defined(Q_OS_WINCE)
|
||||||
QTest::qWait(1000);
|
QTest::qWait(1000);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QFiledialog::cleanup()
|
|
||||||
{
|
|
||||||
QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
|
|
||||||
settings.beginGroup(QLatin1String("Qt"));
|
|
||||||
settings.setValue(QLatin1String("filedialog"), userSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
class MyAbstractItemDelegate : public QAbstractItemDelegate
|
class MyAbstractItemDelegate : public QAbstractItemDelegate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user