Commit d8c8042b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Remove it (not used and in qt5.8 we will have real printdialog support)

parent 4407b175
......@@ -10,8 +10,6 @@ ecm_setup_version(${MESSAGELIB_LIB_VERSION} VARIABLE_PREFIX WEBENGINEVIEWER
########### Targets ###########
add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
option(WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT "Build the print preview support based on poppler." TRUE)
########### CMake Config Files ###########
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5WebEngineViewer")
......
#ifndef CONFIGWEBENGINEVIEWER_H
#define CONFIGWEBENGINEVIEWER_H
#cmakedefine WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT 1
#endif
......@@ -8,36 +8,6 @@ if(BUILD_TESTING)
add_subdirectory(findbar/autotests)
endif()
# Laurent Remove all code when QtWebEngine support real printing Disable it for 5.7 not finish yet
if (Qt5WebEngineWidgets_VERSION VERSION_GREATER "5.7.99")
if (WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT)
find_package(Poppler "0.12.1" COMPONENTS Qt5)
set_package_properties("Poppler" PROPERTIES
TYPE RECOMMENDED
PURPOSE "Support for print preview.")
if (Poppler_Qt5_FOUND)
set(libwebengineviewer_print_SRCS
print/printpreviewdialog.cpp
print/printpreviewpageviewer.cpp
print/printpreviewpagewidget.cpp
print/printwebengineviewjob.cpp
print/printconfiguredialog.cpp
print/printconfigurewidget.cpp
print/printselectpagedialog.cpp
print/printselectpagewidget.cpp
)
set(poppler_lib Poppler::Qt5 Qt5::PrintSupport)
endif()
if(BUILD_TESTING)
add_subdirectory(print/autotests)
add_subdirectory(print/tests)
endif()
endif()
else()
set(WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT FALSE)
endif()
configure_file(../config-webengineviewer.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/../config-webengineviewer.h )
set(libwebengineviewer_webengine_SRCS
......@@ -123,19 +93,6 @@ install(TARGETS
EXPORT KF5WebEngineViewerTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} ${LIBRARY_NAMELINK}
)
if (WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT)
ecm_generate_headers(WebEngineViewer_Camelprint_HEADERS
HEADER_NAMES
PrintPreviewDialog
PrintWebEngineViewJob
PrintConfigureDialog
REQUIRED_HEADERS WebEngineViewer_print_HEADERS
PREFIX WebEngineViewer
RELATIVE print
)
endif()
ecm_generate_headers(WebEngineViewer_Camelfindbar_HEADERS
HEADER_NAMES
FindBarBase
......
......@@ -18,7 +18,6 @@
*/
#include "webengineprintmessageboxtest.h"
#include "webengineviewer/config-webengineviewer.h"
#include "../webengineprintmessagebox.h"
#include <QTest>
#include <QPushButton>
......@@ -40,23 +39,6 @@ void WebEnginePrintMessageBoxTest::shouldHaveDefaultValue()
QPushButton *openInBrowser = box.findChild<QPushButton *>(QStringLiteral("openinbrowser"));
QVERIFY(openInBrowser);
#ifdef WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT
QPushButton *openInPreviewDialogBox = box.findChild<QPushButton *>(QStringLiteral("openprintpreview"));
QVERIFY(openInPreviewDialogBox);
#endif
}
void WebEnginePrintMessageBoxTest::shouldEmitOpenPrintPreviewSignal()
{
WebEngineViewer::WebEnginePrintMessageBox box;
QSignalSpy spyPrintPreview(&box, SIGNAL(openPrintPreview()));
#ifdef WEBENGINEVIEWER_PRINTPREVIEW_SUPPORT
QPushButton *openInPreviewDialogBox = box.findChild<QPushButton *>(QStringLiteral("openprintpreview"));
QTest::mouseClick(openInPreviewDialogBox, Qt::LeftButton);
QCOMPARE(spyPrintPreview.count(), 1);
#else
Q_UNUSED(spyPrintPreview);
#endif
}
void WebEnginePrintMessageBoxTest::shouldEmitOpenInBrowserSignal()
......
......@@ -31,7 +31,6 @@ public:
private Q_SLOTS:
void shouldHaveDefaultValue();
void shouldEmitOpenPrintPreviewSignal();
void shouldEmitOpenInBrowserSignal();
};
......
set(print_autotest_SRCS)
ecm_qt_declare_logging_category(print_autotest_SRCS HEADER webengineviewer_debug.h IDENTIFIER WEBENGINEVIEWER_LOG CATEGORY_NAME log_webengineviewer)
ecm_add_test(printpreviewdialogtest.cpp ../printpreviewdialog.cpp ../printpreviewpageviewer.cpp ../printpreviewpagewidget.cpp ../printselectpagedialog.cpp ../printselectpagewidget.cpp ${print_autotest_SRCS}
TEST_NAME printpreviewdialogtest
NAME_PREFIX "webengineviewer-print-"
LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::Gui KF5::I18n KF5::WidgetsAddons Poppler::Qt5 KF5::ConfigCore
)
ecm_add_test(printpreviewpageviewertest.cpp ../printpreviewpageviewer.cpp ${print_autotest_SRCS}
TEST_NAME printpreviewpagetest
NAME_PREFIX "webengineviewer-print-"
LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::Gui KF5::I18n KF5::WidgetsAddons Poppler::Qt5 KF5::ConfigCore
)
ecm_add_test(printpreviewpagewidgettest.cpp ../printpreviewpagewidget.cpp ../printpreviewpageviewer.cpp ${print_autotest_SRCS}
TEST_NAME printpreviewpagewidgettest
NAME_PREFIX "webengineviewer-print-"
LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::Gui KF5::I18n KF5::WidgetsAddons Poppler::Qt5 KF5::ConfigCore
)
ecm_add_test(printwebengineviewjobtest.cpp ../printwebengineviewjob.cpp ${print_autotest_SRCS}
TEST_NAME printwebengineviewjobtest
NAME_PREFIX "webengineviewer-print-"
LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::WebEngineWidgets Qt5::PrintSupport
)
ecm_add_test(printconfiguredialogtest.cpp ../printconfiguredialog.cpp ../printconfigurewidget.cpp ${print_autotest_SRCS}
TEST_NAME printconfiguredialogtest
NAME_PREFIX "webengineviewer-print-"
LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::Gui KF5::I18n Qt5::PrintSupport
)
ecm_add_test(printconfigurewidgettest.cpp ../printconfigurewidget.cpp ${print_autotest_SRCS}
TEST_NAME printconfigurewidgettest
NAME_PREFIX "webengineviewer-print-"
LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::Gui KF5::I18n Qt5::PrintSupport
)
ecm_add_test(printselectpagedialogtest.cpp ../printselectpagedialog.cpp ../printselectpagewidget.cpp ${print_autotest_SRCS}
TEST_NAME printselectpagedialogtest
NAME_PREFIX "webengineviewer-print-"
LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::Gui KF5::I18n Qt5::PrintSupport KF5::ConfigCore
)
ecm_add_test(printselectpagewidgettest.cpp ../printselectpagewidget.cpp ${print_autotest_SRCS}
TEST_NAME printselectpagewidgettest
NAME_PREFIX "webengineviewer-print-"
LINK_LIBRARIES Qt5::Test Qt5::Widgets Qt5::Gui KF5::I18n Qt5::PrintSupport
)
/*
Copyright (C) 2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "printconfiguredialogtest.h"
#include "../printconfiguredialog.h"
#include "../printconfigurewidget.h"
#include <QTest>
#include <QDialogButtonBox>
PrintConfigureDialogTest::PrintConfigureDialogTest(QObject *parent)
: QObject(parent)
{
}
PrintConfigureDialogTest::~PrintConfigureDialogTest()
{
}
void PrintConfigureDialogTest::shouldHaveDefaultValue()
{
WebEngineViewer::PrintConfigureDialog dlg;
WebEngineViewer::PrintConfigureWidget *w = dlg.findChild<WebEngineViewer::PrintConfigureWidget *>(QStringLiteral("configurewidget"));
QVERIFY(w);
QDialogButtonBox *buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonBox"));
QVERIFY(buttonBox);
}
QTEST_MAIN(PrintConfigureDialogTest)
/*
Copyright (C) 2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef PRINTCONFIGUREDIALOGTEST_H
#define PRINTCONFIGUREDIALOGTEST_H
#include <QObject>
class PrintConfigureDialogTest : public QObject
{
Q_OBJECT
public:
explicit PrintConfigureDialogTest(QObject *parent = Q_NULLPTR);
~PrintConfigureDialogTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // PRINTCONFIGUREDIALOGTEST_H
/*
Copyright (C) 2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "printconfigurewidgettest.h"
#include "../printconfigurewidget.h"
#include <QTest>
#include <QLayout>
#include <QLabel>
#include <QToolButton>
PrintConfigureWidgetTest::PrintConfigureWidgetTest(QObject *parent)
: QObject(parent)
{
}
PrintConfigureWidgetTest::~PrintConfigureWidgetTest()
{
}
void PrintConfigureWidgetTest::shouldHaveDefaultValue()
{
WebEngineViewer::PrintConfigureWidget w;
QCOMPARE(w.layout()->margin(), 0);
QLabel *printLayoutLabel = w.findChild<QLabel *>(QStringLiteral("printlayoutlabel"));
QVERIFY(printLayoutLabel);
QVERIFY(!printLayoutLabel->text().isEmpty());
QVBoxLayout *printLayout = w.findChild<QVBoxLayout *>(QStringLiteral("printLayout"));
QVERIFY(printLayout);
QCOMPARE(printLayout->margin(), 0);
QToolButton *selectPrintLayout = w.findChild<QToolButton *>(QStringLiteral("selectprintlayout"));
QVERIFY(selectPrintLayout);
QVERIFY(w.currentPageLayout().isValid());
}
QTEST_MAIN(PrintConfigureWidgetTest)
/*
Copyright (C) 2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef PRINTCONFIGUREWIDGETTEST_H
#define PRINTCONFIGUREWIDGETTEST_H
#include <QObject>
class PrintConfigureWidgetTest : public QObject
{
Q_OBJECT
public:
explicit PrintConfigureWidgetTest(QObject *parent = Q_NULLPTR);
~PrintConfigureWidgetTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // PRINTCONFIGUREWIDGETTEST_H
/*
Copyright (C) 2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "printpreviewdialogtest.h"
#include "../printpreviewdialog.h"
#include "../printpreviewpagewidget.h"
#include <QTest>
#include <QDialogButtonBox>
#include <QPushButton>
PrintPreviewDialogTest::PrintPreviewDialogTest(QObject *parent)
: QObject(parent)
{
}
PrintPreviewDialogTest::~PrintPreviewDialogTest()
{
}
void PrintPreviewDialogTest::shouldHaveDefaultValue()
{
WebEngineViewer::PrintPreviewDialog dlg;
WebEngineViewer::PrintPreviewPageWidget *widget = dlg.findChild<WebEngineViewer::PrintPreviewPageWidget *>(QStringLiteral("printpreviewwidget"));
QVERIFY(widget);
QDialogButtonBox *buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
QVERIFY(buttonBox);
QPushButton *printButton = buttonBox->findChild<QPushButton *>(QStringLiteral("printbutton"));
QVERIFY(printButton);
}
QTEST_MAIN(PrintPreviewDialogTest)
/*
Copyright (C) 2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef PRINTPREVIEWDIALOGTEST_H
#define PRINTPREVIEWDIALOGTEST_H
#include <QObject>
class PrintPreviewDialogTest : public QObject
{
Q_OBJECT
public:
explicit PrintPreviewDialogTest(QObject *parent = Q_NULLPTR);
~PrintPreviewDialogTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // PRINTPREVIEWDIALOGTEST_H
/*
Copyright (C) 2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "printpreviewpageviewertest.h"
#include "../printpreviewpageviewer.h"
#include <QLabel>
#include <QTest>
PrintPreviewPageViewerTest::PrintPreviewPageViewerTest(QObject *parent)
: QObject(parent)
{
}
PrintPreviewPageViewerTest::~PrintPreviewPageViewerTest()
{
}
void PrintPreviewPageViewerTest::shouldHaveDefaultValue()
{
WebEngineViewer::PrintPreviewPageViewer page;
QLabel *label = page.findChild<QLabel *>(QStringLiteral("page"));
QVERIFY(label);
QCOMPARE(page.zoom(), 1.0);
}
QTEST_MAIN(PrintPreviewPageViewerTest)
/*
Copyright (C) 2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef PRINTPREVIEWPAGEVIEWERTEST_H
#define PRINTPREVIEWPAGEVIEWERTEST_H
#include <QObject>
class PrintPreviewPageViewerTest : public QObject
{
Q_OBJECT
public:
explicit PrintPreviewPageViewerTest(QObject *parent = Q_NULLPTR);
~PrintPreviewPageViewerTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // PRINTPREVIEWPAGEVIEWERTEST_H
/*
Copyright (C) 2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "printpreviewpagewidgettest.h"
#include "../printpreviewpagewidget.h"
#include "../printpreviewpageviewer.h"
#include <QTest>
#include <QLayout>
#include <QHBoxLayout>
#include <QLabel>
#include <QComboBox>
PrintPreviewPageWidgetTest::PrintPreviewPageWidgetTest(QObject *parent)
: QObject(parent)
{
}
PrintPreviewPageWidgetTest::~PrintPreviewPageWidgetTest()
{
}
void PrintPreviewPageWidgetTest::shouldHaveNotMargin()
{
WebEngineViewer::PrintPreviewPageWidget w;
QCOMPARE(w.layout()->margin(), 0);
}
void PrintPreviewPageWidgetTest::shouldHaveDefaultValue()
{
WebEngineViewer::PrintPreviewPageWidget w;
WebEngineViewer::PrintPreviewPageViewer *page = w.findChild<WebEngineViewer::PrintPreviewPageViewer *>(QStringLiteral("printpreviewpage"));
QVERIFY(page);
QHBoxLayout *hbox = w.findChild<QHBoxLayout *>(QStringLiteral("layoutcombobox"));
QVERIFY(hbox);
QCOMPARE(hbox->margin(), 0);
QLabel *lab = w.findChild<QLabel *>(QStringLiteral("labelcombobox"));
QVERIFY(lab);
QComboBox *mPageComboBox = w.findChild<QComboBox *>(QStringLiteral("pagecombobox"));
QVERIFY(mPageComboBox);
QCOMPARE(mPageComboBox->count(), 0);
QVERIFY(!w.deleteFile());
}
QTEST_MAIN(PrintPreviewPageWidgetTest)
/*
Copyright (C) 2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to