~mutse-young/ubuntu-docviewer-app/trunk

« back to all changes in this revision

Viewing changes to tests/autopilot/ubuntu_docviewer_app/tests/test_toc.py

  • Committer: Tarmac
  • Author(s): carla-sella
  • Date: 2015-05-15 12:47:01 UTC
  • mfrom: (127.1.19 test-toc)
  • Revision ID: tarmac-20150515124701-q65mnbh76iix4yqf
First test for testing Docviewer app TOC. Fixes: https://bugs.launchpad.net/bugs/1418652.

Approved by Ubuntu Phone Apps Jenkins Bot, Nicholas Skaggs, Stefano Verzegnassi.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
 
2
# Copyright 2013 Canonical
 
3
#
 
4
# This program is free software: you can redistribute it and/or modify it
 
5
# under the terms of the GNU General Public License version 3, as published
 
6
# by the Free Software Foundation.
 
7
 
 
8
"""Docviewer app autopilot tests."""
 
9
 
 
10
from ubuntu_docviewer_app.tests import DocviewerAppTestCase
 
11
 
 
12
import logging
 
13
logger = logging.getLogger(__name__)
 
14
 
 
15
 
 
16
class TestMainWindow(DocviewerAppTestCase):
 
17
 
 
18
    """Tests the TOC features"""
 
19
    scenarios = [
 
20
        ('Chapter 1',
 
21
            {'content_label': 'Chapter 1. Introduction'
 
22
             }),
 
23
 
 
24
        ('Chapter 3',
 
25
            {'content_label': 'Chapter 3. Package Management',
 
26
             })
 
27
    ]
 
28
 
 
29
    def setUp(self):
 
30
        super(TestMainWindow, self).setUp()
 
31
        self.filepath = 'ubuntu_docviewer_app/files/serverguide.pdf'
 
32
 
 
33
    def test_go_to_chapters_in_toc(self):
 
34
        """" Testing going to chapters from Table Of Contents     """
 
35
 
 
36
        self.launch_app()
 
37
        pdf = self.app.main_view.open_PdfView()
 
38
        pdf.reveal_bottom_edge_page()
 
39
        contents_page = self.app.main_view.open_PdfContentsPage()
 
40
        content_line, page_no = contents_page.\
 
41
            get_content_and_line_pageindex(self.content_label)
 
42
        contents_page.click_content_line(content_line)
 
43
 
 
44
        word_in_currentpage = pdf.get_currentpage_number().split()
 
45
        pdfview_currentpage = word_in_currentpage[1]
 
46
 
 
47
        self.assertEquals(pdfview_currentpage, page_no)