Commit 13070218 authored by Oliver Sander's avatar Oliver Sander Committed by Albert Astals Cid
Browse files

Test whether documents that request fullscreen are handled properly

parent 08a76add
Pipeline #20304 passed with stage
in 7 minutes and 53 seconds
...@@ -100,6 +100,7 @@ class PartTest ...@@ -100,6 +100,7 @@ class PartTest
void testTabletProximityBehavior(); void testTabletProximityBehavior();
void testOpenPrintPreview(); void testOpenPrintPreview();
void testMouseModeMenu(); void testMouseModeMenu();
void testFullScreenRequest();
private: private:
void simulateMouseSelection(double startX, double startY, double endX, double endY, QWidget *target); void simulateMouseSelection(double startX, double startY, double endX, double endY, QWidget *target);
...@@ -1992,6 +1993,33 @@ void PartTest::testMouseModeMenu() ...@@ -1992,6 +1993,33 @@ void PartTest::testMouseModeMenu()
QCOMPARE(Okular::Settings::mouseMode(), (int)Okular::Settings::EnumMouseMode::TableSelect ); QCOMPARE(Okular::Settings::mouseMode(), (int)Okular::Settings::EnumMouseMode::TableSelect );
} }
void PartTest::testFullScreenRequest()
{
QVariantList dummyArgs;
Okular::Part part(nullptr, nullptr, dummyArgs);
// Open file. For this particular file, a dialog has to appear asking whether
// one wants to comply with the wish to go to presentation mode directly.
// Answer 'no'
auto dialogHelper = std::make_unique<TestingUtils::CloseDialogHelper>( &part, QDialogButtonBox::No );
QVERIFY( openDocument(&part, QStringLiteral(KDESRCDIR "data/RequestFullScreen.pdf")) );
// Check that we are not in presentation mode
QEXPECT_FAIL("", "The presentation widget should not be shown because we clicked No in the dialog", Continue);
QTRY_VERIFY_WITH_TIMEOUT( part.m_presentationWidget, 1000 );
// Reload the file. The initial dialog should no appear again.
// (This is https://bugs.kde.org/show_bug.cgi?id=361740)
part.reload();
// Open the file again. Now we answer "yes, go to presentation mode"
dialogHelper = std::make_unique<TestingUtils::CloseDialogHelper>( &part, QDialogButtonBox::Yes );
QVERIFY( openDocument(&part, QStringLiteral(KDESRCDIR "data/RequestFullScreen.pdf")) );
// Test whether we really are in presentation mode
QTRY_VERIFY( part.m_presentationWidget );
}
} // namespace Okular } // namespace Okular
int main(int argc, char *argv[]) int main(int argc, char *argv[])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment