diff --git a/part.h b/part.h index a5f60d10f..4b3aafdb6 100644 --- a/part.h +++ b/part.h @@ -101,7 +101,6 @@ class OKULAR_PART_EXPORT Part : public KParts::ReadWritePart, public Okular::Doc Q_INTERFACES(Okular::ViewerInterface) friend class PartTest; - friend class EpubInternalLinksTest; public: // Default constructor diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 9901a871a..800a2a7f6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -29,6 +29,3 @@ target_link_libraries( translateannotationtest ${KDE4_KDECORE_LIBS} ${QT_QTGUI_L kde4_add_unit_test( modifyannotationpropertiestest modifyannotationpropertiestest.cpp testingutils.cpp) target_link_libraries( modifyannotationpropertiestest ${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY} ${QT_QTTEST_LIBRARY} ${QT_QTXML_LIBRARY} okularcore ) - -kde4_add_unit_test( epubinternallinkstest epubinternallinkstest.cpp ) -target_link_libraries( epubinternallinkstest ${KDE4_KDECORE_LIBS} ${KDE4_KPARTS_LIBS} ${QT_QTTEST_LIBRARY} ${QT_QTGUI_LIBRARY} okularpart okularcore ) diff --git a/tests/epubinternallinkstest.cpp b/tests/epubinternallinkstest.cpp deleted file mode 100644 index 7c47b8f34..000000000 --- a/tests/epubinternallinkstest.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2013 Jaydeep Solanki * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - ***************************************************************************/ - -#include - -#include "../part.h" -#include "../core/action.h" -#include "../core/page.h" - -namespace Okular -{ -class EpubInternalLinksTest : public QObject -{ - Q_OBJECT -private slots: - void testInternalLinks_data(); - void testInternalLinks(); -}; - -void EpubInternalLinksTest::testInternalLinks() -{ - QVariantList dummyArgs; - Okular::Part part(NULL, NULL, dummyArgs, KGlobal::mainComponent()); - part.openDocument(KDESRCDIR "data/contents.epub"); - Okular::Document *doc = part.m_document; - doc->setViewportPage(0); - QVERIFY(doc); - - int width = doc->page( 0 )->width(); // 0 because current page is zero - int height = doc->page( 0 )->height(); - QFETCH( double, yCords ); - QFETCH( int , pagesNos ); - const ObjectRect *rect = doc->page( 0 )->objectRect( ObjectRect::Action, 0.0453564, yCords, width, height); - QVERIFY( rect ); - const Okular::Action * action = static_cast< const Okular::Action * >( rect->object() ); - QCOMPARE( action->actionType(), Action::Goto ); - const Okular::GotoAction * gAction = static_cast< const Okular::GotoAction * >( action ); - QCOMPARE( gAction->destViewport().pageNumber, pagesNos ); - doc->processAction( action ); - QCOMPARE( doc->currentPage(), ( uint ) pagesNos ); - part.slotGotoFirst(); -} - - -void EpubInternalLinksTest::testInternalLinks_data() -{ - QTest::addColumn< double >( "yCords" ); - QTest::addColumn< int >( "pagesNos" ); - QTest::newRow( "0.025" ) << 0.025 << 0; - QTest::newRow( "0.06" ) << 0.06 << 1; - QTest::newRow( "0.095" ) << 0.095 << 0; - QTest::newRow( "0.13" ) << 0.13 << 1; - QTest::newRow( "0.165" ) << 0.165 << 1; - QTest::newRow( "0.2" ) << 0.2 << 1; - QTest::newRow( "0.235" ) << 0.235 << 2; - QTest::newRow( "0.27" ) << 0.27 << 2; - QTest::newRow( "0.305" ) << 0.305 << 2; - QTest::newRow( "0.34" ) << 0.34 << 2; -} - -} - -QTEST_KDEMAIN( Okular::EpubInternalLinksTest, GUI ) - -#include "epubinternallinkstest.moc"