mirror of
https://invent.kde.org/graphics/okular
synced 2024-09-13 13:11:41 +00:00
Revert the test, it's broken
This commit is contained in:
parent
38ef3cabf8
commit
ea8316960e
1
part.h
1
part.h
|
@ -101,7 +101,6 @@ class OKULAR_PART_EXPORT Part : public KParts::ReadWritePart, public Okular::Doc
|
||||||
Q_INTERFACES(Okular::ViewerInterface)
|
Q_INTERFACES(Okular::ViewerInterface)
|
||||||
|
|
||||||
friend class PartTest;
|
friend class PartTest;
|
||||||
friend class EpubInternalLinksTest;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Default constructor
|
// Default constructor
|
||||||
|
|
|
@ -29,6 +29,3 @@ target_link_libraries( translateannotationtest ${KDE4_KDECORE_LIBS} ${QT_QTGUI_L
|
||||||
|
|
||||||
kde4_add_unit_test( modifyannotationpropertiestest modifyannotationpropertiestest.cpp testingutils.cpp)
|
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 )
|
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 )
|
|
||||||
|
|
|
@ -1,71 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* Copyright (C) 2013 Jaydeep Solanki <jaydp17@gmail.com> *
|
|
||||||
* *
|
|
||||||
* 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 <qtest_kde.h>
|
|
||||||
|
|
||||||
#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"
|
|
Loading…
Reference in a new issue