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

« back to all changes in this revision

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

  • Committer: Omer Akram
  • Date: 2013-05-31 11:28:00 UTC
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: om26er@ubuntu.com-20130531112800-bfcz8wxtf6jxjvwa
add initial autopilot skeleton and packaging

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 __future__ import absolute_import
 
11
 
 
12
from autopilot.matchers import Eventually
 
13
from testtools.matchers import Equals
 
14
 
 
15
from ubuntu_docviewer_app.tests import DocviewerTestCase
 
16
 
 
17
 
 
18
class TestMainWindow(DocviewerTestCase):
 
19
 
 
20
    def setUp(self):
 
21
        super(TestMainWindow, self).setUp()
 
22
        self.assertThat(
 
23
            self.main_window.get_qml_view().visible, Eventually(Equals(True)))
 
24
 
 
25
    def tearDown(self):
 
26
        super(TestMainWindow, self).tearDown()
 
27
 
 
28
    def test_toolbar_shows(self):
 
29
        """Make sure that dragging from the bottom reveals the hidden
 
30
        toolbar."""
 
31
        toolbar = self.main_window.get_toolbar()
 
32
 
 
33
        x, y, w, h = toolbar.globalRect
 
34
        tx = x + (w / 2)
 
35
        ty = y + (h - 2)
 
36
 
 
37
        self.pointing_device.drag(tx, ty, tx, ty - h)
 
38
        self.assertThat(toolbar.state, Eventually(Equals("spread")))