ubuntu-touch-coreapps-reviewers team mailing list archive
-
ubuntu-touch-coreapps-reviewers team
-
Mailing list archive
-
Message #01879
[Merge] lp:~carla-sella/ubuntu-docviewer-app/test-toc into lp:ubuntu-docviewer-app
Carla Sella has proposed merging lp:~carla-sella/ubuntu-docviewer-app/test-toc into lp:ubuntu-docviewer-app.
Commit message:
First test for testing Docviewer app TOC.
Requested reviews:
Stefano Verzegnassi (verzegnassi-stefano)
Related bugs:
Bug #1418652 in Ubuntu Document Viewer App: "Autopilot Testcase Needed: Test PDF table of contents"
https://bugs.launchpad.net/ubuntu-docviewer-app/+bug/1418652
For more details, see:
https://code.launchpad.net/~carla-sella/ubuntu-docviewer-app/test-toc/+merge/258082
First test for testing Docviewer app TOC.
--
Your team Ubuntu Document Viewer Developers is subscribed to branch lp:ubuntu-docviewer-app.
=== modified file 'po/com.ubuntu.docviewer.pot'
--- po/com.ubuntu.docviewer.pot 2015-04-27 16:02:40 +0000
+++ po/com.ubuntu.docviewer.pot 2015-05-01 21:01:09 +0000
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-04-27 18:02+0200\n"
+"POT-Creation-Date: 2015-05-01 16:54+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -34,7 +34,7 @@
#: ../src/app/docviewer-application.cpp:164
#: ../src/app/qml/documentPage/DocumentPage.qml:25
-#: /home/stefano/tmp/build-ch-imported-documents-name-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1
+#: /home/letozaf/autopilot-tests/build-ubuntu-docviewer-app-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:1
msgid "Document Viewer"
msgstr ""
@@ -257,12 +257,12 @@
msgstr ""
#. TRANSLATORS: "Contents" refers to the "Table of Contents" of a PDF document.
-#: ../src/app/qml/pdfView/PdfContentsPage.qml:26
+#: ../src/app/qml/pdfView/PdfContentsPage.qml:31
#: ../src/app/qml/pdfView/PdfView.qml:37
msgid "Contents"
msgstr ""
-#: ../src/app/qml/pdfView/PdfContentsPage.qml:32
+#: ../src/app/qml/pdfView/PdfContentsPage.qml:37
msgid "Hide table of contents"
msgstr ""
@@ -319,6 +319,6 @@
msgid "Open"
msgstr ""
-#: /home/stefano/tmp/build-ch-imported-documents-name-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2
+#: /home/letozaf/autopilot-tests/build-ubuntu-docviewer-app-Desktop-Default/po/com.ubuntu.docviewer.desktop.in.in.h:2
msgid "documents;viewer;pdf;reader;"
msgstr ""
=== modified file 'src/app/qml/pdfView/PdfContentsPage.qml'
--- src/app/qml/pdfView/PdfContentsPage.qml 2015-04-16 12:58:29 +0000
+++ src/app/qml/pdfView/PdfContentsPage.qml 2015-05-01 21:01:09 +0000
@@ -22,6 +22,11 @@
import "../upstreamComponents"
Page {
+ id: pdfContents
+ objectName: "pdfcontents"
+
+ property string testProperty: "for page name issue"
+
// TRANSLATORS: "Contents" refers to the "Table of Contents" of a PDF document.
title: i18n.tr("Contents")
@@ -57,6 +62,7 @@
ListView {
id: view
+ objectName: "view"
anchors.fill: parent
clip: true
@@ -64,6 +70,7 @@
delegate: ListItemWithActions {
id: delegate
+ objectName: "delegate" + index
width: parent.width
height: (model.level === 0) ? units.gu(7) : units.gu(6)
@@ -73,6 +80,7 @@
: Theme.palette.normal.background
AbstractButton {
+ objectName: "abstractbutton"
anchors.fill: parent
onClicked: {
@@ -91,6 +99,7 @@
spacing: units.gu(1)
Label {
+ objectName: "content"
Layout.fillWidth: true
text: model.title
@@ -102,6 +111,7 @@
}
Label {
+ objectName: "pageindex"
text: model.pageIndex + 1
font.weight: model.level == 0 ? Font.DemiBold : Font.Normal
color: (model.level === 0) ? UbuntuColors.midAubergine
=== modified file 'tests/autopilot/ubuntu_docviewer_app/__init__.py'
--- tests/autopilot/ubuntu_docviewer_app/__init__.py 2015-04-14 15:37:06 +0000
+++ tests/autopilot/ubuntu_docviewer_app/__init__.py 2015-05-01 21:01:09 +0000
@@ -20,6 +20,7 @@
from autopilot import logging as autopilot_logging
logger = logging.getLogger(__name__)
+from autopilot.introspection import dbus
import ubuntuuitoolkit
@@ -58,6 +59,15 @@
return self.wait_select_single(PdfView)
@autopilot_logging.log_action(logger.info)
+ def open_PdfContentsPage(self):
+ """Open the PdfContents Page.
+
+ :return the PdfContents Page
+
+ """
+ return self.wait_select_single(PdfContentsPage)
+
+ @autopilot_logging.log_action(logger.info)
def get_PdfViewGotoDialog(self):
"""Return a dialog emulator"""
return self.wait_select_single(objectName="PdfViewGotoDialog")
@@ -82,7 +92,34 @@
self.main_view = self.get_root_instance().select_single(MainView)
-class PdfView(Page):
+class PageWithBottomEdge(MainView):
+ """
+ An emulator class that makes it easy to interact with the bottom edge
+ swipe page
+ """
+ def __init__(self, *args):
+ super(PageWithBottomEdge, self).__init__(*args)
+
+ def reveal_bottom_edge_page(self):
+ """Bring the bottom edge page to the screen"""
+ self.bottomEdgePageLoaded.wait_for(True)
+ try:
+ action_item = self.wait_select_single(objectName='bottomEdgeTip')
+ action_item.visible.wait_for(True)
+ start_x = (action_item.globalRect.x +
+ (action_item.globalRect.width * 0.5))
+ start_y = (action_item.globalRect.y +
+ (action_item.height * 0.5))
+ stop_y = start_y - (self.height * 0.7)
+ self.pointing_device.drag(start_x, start_y,
+ start_x, stop_y, rate=2)
+ self.isReady.wait_for(True)
+ except dbus.StateNotFoundError:
+ logger.error('BottomEdge element not found.')
+ raise
+
+
+class PdfView(PageWithBottomEdge):
"""Autopilot helper for PdfView page."""
@autopilot_logging.log_action(logger.info)
@@ -94,3 +131,55 @@
"""Click the go_to_page header button."""
header = self.main_view.get_header()
header.click_action_button('gotopage')
+
+ def get_currentpage_number(self):
+ """return the value of the currentPage property"""
+ logger.warn(self.currentPage)
+ return self.currentPage
+
+
+class PdfContentsPage(Page):
+ """Autopilot helper for PdfContents page."""
+
+ @autopilot_logging.log_action(logger.info)
+ def get_content_and_line_pageindex(self, labelText):
+ content_line, page_no = self._get_listitem(labelText)
+ return content_line, page_no
+
+ def _get_listitem(self, labelText):
+ list_items_count = self.select_single(
+ "QQuickListView", objectName="view").count
+
+ index = 0
+ for index in range(list_items_count):
+ while True:
+ try:
+ list_item = self.select_single(
+ "ListItemWithActions", objectName="delegate{}".
+ format(index))
+ break
+ except dbus.StateNotFoundError:
+ self.scroll_pdfcontentspage()
+ label = list_item.select_single("Label", objectName="content")
+ if label.text == labelText:
+ page_no = list_item.select_single(
+ "Label", objectName="pageindex").text
+ return label, page_no
+ break
+
+ @autopilot_logging.log_action(logger.info)
+ def click_content_line(self, content_line):
+ self.pointing_device.click_object(content_line)
+ self.visible.wait_for(True)
+
+ @autopilot_logging.log_action(logger.info)
+ def scroll_pdfcontentspage(self):
+ action_item = self.select_single("QQuickListView")
+ start_x = (action_item.globalRect.x +
+ (action_item.globalRect.width * 0.5))
+ start_y = (action_item.globalRect.y +
+ (action_item.height * 0.5))
+ stop_y = start_y - (self.height * 0.7)
+ self.pointing_device.drag(start_x, start_y,
+ start_x, stop_y, rate=2)
+ action_item.moving.wait_for(False)
=== added file 'tests/autopilot/ubuntu_docviewer_app/files/serverguide.pdf'
Binary files tests/autopilot/ubuntu_docviewer_app/files/serverguide.pdf 1970-01-01 00:00:00 +0000 and tests/autopilot/ubuntu_docviewer_app/files/serverguide.pdf 2015-05-01 21:01:09 +0000 differ
References