Changeset View
Changeset View
Standalone View
Standalone View
autotests/kfiledialog_unittest.cpp
Show First 20 Lines • Show All 341 Lines • ▼ Show 20 Line(s) | 341 | } else { | |||
---|---|---|---|---|---|
342 | QVERIFY(!messageBoxExpected); | 342 | QVERIFY(!messageBoxExpected); | ||
343 | } | 343 | } | ||
344 | }); | 344 | }); | ||
345 | fw->slotOk(); | 345 | fw->slotOk(); | ||
346 | 346 | | |||
347 | QTRY_VERIFY(timerRun); | 347 | QTRY_VERIFY(timerRun); | ||
348 | } | 348 | } | ||
349 | 349 | | |||
350 | void testRememberLastDirectory() | ||||
351 | { | ||||
352 | const QUrl dir = QUrl::fromLocalFile(QDir::tempPath()).adjusted(QUrl::StripTrailingSlash); | ||||
353 | // Open and navigate | ||||
354 | { | ||||
355 | QFileDialog dialog; | ||||
356 | dialog.open(); | ||||
357 | | ||||
358 | KFileWidget *fw = findFileWidget(); | ||||
359 | QVERIFY(fw); | ||||
360 | // real show() is delayed to next event. | ||||
361 | QVERIFY(QTest::qWaitForWindowExposed(fw->window())); | ||||
362 | QCOMPARE(fw->isVisible(), true); | ||||
363 | fw->setUrl(dir); | ||||
364 | fw->slotCancel(); | ||||
365 | } | ||||
366 | // Open another filedialog, check that the default directory is the one from above | ||||
367 | { | ||||
368 | QFileDialog dialog; | ||||
369 | dialog.open(); | ||||
370 | | ||||
371 | KFileWidget *fw = findFileWidget(); | ||||
372 | QVERIFY(fw); | ||||
373 | // real show() is delayed to next event. | ||||
374 | QVERIFY(QTest::qWaitForWindowExposed(fw->window())); | ||||
375 | QCOMPARE(fw->isVisible(), true); | ||||
376 | QCOMPARE(dialog.directoryUrl().adjusted(QUrl::StripTrailingSlash), dir); | ||||
377 | fw->slotCancel(); | ||||
378 | } | ||||
379 | } | ||||
380 | | ||||
350 | private: | 381 | private: | ||
351 | QTemporaryDir m_tempDir; | 382 | QTemporaryDir m_tempDir; | ||
352 | 383 | | |||
353 | static QString fileViewToString(KFile::FileView fv) | 384 | static QString fileViewToString(KFile::FileView fv) | ||
354 | { | 385 | { | ||
355 | switch (fv) { | 386 | switch (fv) { | ||
356 | case KFile::Detail: | 387 | case KFile::Detail: | ||
357 | return QStringLiteral("Detail"); | 388 | return QStringLiteral("Detail"); | ||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |