Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 889c9429 authored by Fabio D'Urso's avatar Fabio D'Urso

Test that we don't crash if we open the Configure backends dialog twice

This would have caught the issue fixed in 3dd3a000
parent 3c7d61fc
......@@ -1033,7 +1033,7 @@ void Part::setWindowTitleFromDocument()
emit setWindowCaption( title );
}
void Part::slotGeneratorPreferences( )
KConfigDialog * Part::slotGeneratorPreferences( )
{
// Create dialog
KConfigDialog * dialog = new KConfigDialog( m_pageView, "generator_prefs", Okular::Settings::self() );
......@@ -1053,6 +1053,8 @@ void Part::slotGeneratorPreferences( )
// Show it
dialog->setWindowModality( Qt::ApplicationModal );
dialog->show();
return dialog;
}
......
......@@ -37,6 +37,7 @@ class QPrinter;
class QMenu;
class KUrl;
class KConfigDialog;
class KConfigGroup;
class KDirWatch;
class KToggleAction;
......@@ -221,6 +222,7 @@ class OKULAR_PART_EXPORT Part : public KParts::ReadWritePart, public Okular::Doc
void slotFileDirty( const QString& );
void slotDoFileDirty();
void psTransformEnded(int, QProcess::ExitStatus);
KConfigDialog * slotGeneratorPreferences();
private:
void setupViewerActions();
......@@ -332,7 +334,6 @@ class OKULAR_PART_EXPORT Part : public KParts::ReadWritePart, public Okular::Doc
FileKeeper *m_keeper;
private slots:
void slotGeneratorPreferences();
void slotAnnotationPreferences();
void slotHandleActivatedSourceReference(const QString& absFileName, int line, int col, bool *handled);
};
......
......@@ -12,6 +12,7 @@
#include "../part.h"
#include "../ui/toc.h"
#include <KConfigDialog>
#include <KStandardDirs>
#include <KTempDir>
......@@ -29,6 +30,7 @@ class PartTest
void testTOCReload();
void testFowardPDF();
void testFowardPDF_data();
void testGeneratorPreferences();
};
void PartTest::testReload()
......@@ -93,6 +95,24 @@ void PartTest::testFowardPDF_data()
QTest::newRow("utf8") << QString(KGlobal::dirs()->resourceDirs("tmp")[0] + QString::fromUtf8("ßðđđŋßðđŋ"));
}
void PartTest::testGeneratorPreferences()
{
KConfigDialog * dialog;
QVariantList dummyArgs;
Okular::Part part(NULL, NULL, dummyArgs, KGlobal::mainComponent());
// Test that we don't crash while opening the dialog
dialog = part.slotGeneratorPreferences();
qApp->processEvents();
delete dialog; // closes the dialog and recursively destroys all widgets
// Test that we don't crash while opening a new instance of the dialog
// This catches attempts to reuse widgets that have been destroyed
dialog = part.slotGeneratorPreferences();
qApp->processEvents();
delete dialog;
}
}
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