1
1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3
# Copyright (C) 2013, 2014 Canonical Ltd.
3
# Copyright (C) 2013-2015 Canonical Ltd.
5
5
# This program is free software; you can redistribute it and/or modify
6
6
# it under the terms of the GNU Lesser General Public License as published by
14
14
# You should have received a copy of the GNU Lesser General Public License
15
15
# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
from unittest import mock
17
from unittest import mock
22
19
import ubuntuuitoolkit
23
20
from ubuntuuitoolkit import tests
26
class MainViewTestCase(tests.QMLStringAppTestCase):
23
class MainView10TestCase(tests.QMLStringAppTestCase):
30
import Ubuntu.Components 0.1
27
import Ubuntu.Components 1.0
33
30
width: units.gu(48)
34
31
height: units.gu(60)
32
objectName: "mainView"
77
75
str(error), 'The MainView has no Tabs.')
78
class MainView12TestCase(tests.QMLStringAppTestCase):
82
import Ubuntu.Components 1.2
87
objectName: "mainView"
91
def test_main_view_custom_proxy_object(self):
92
self.assertIsInstance(self.main_view, ubuntuuitoolkit.MainView)
94
def test_get_header_without_header(self):
95
header = self.main_view.get_header()
96
self.assertFalse(header.visible)
98
def test_get_tabs_without_tabs(self):
99
error = self.assertRaises(
100
ubuntuuitoolkit.ToolkitException, self.main_view.get_tabs)
102
str(error), 'The MainView has no Tabs.')
104
def test_switch_to_next_tab_without_tabs(self):
105
header = self.main_view.get_header()
106
error = self.assertRaises(
107
ubuntuuitoolkit.ToolkitException,
108
header.switch_to_next_tab)
110
str(error), 'The MainView has no Tabs.')
112
def test_get_toolbar_without_toolbar(self):
113
error = self.assertRaises(
114
ubuntuuitoolkit.ToolkitException, self.main_view.get_toolbar)
116
str(error), 'The MainView has no Toolbar.')
118
def test_open_toolbar_without_toolbar(self):
119
error = self.assertRaises(
120
ubuntuuitoolkit.ToolkitException, self.main_view.open_toolbar)
122
str(error), 'The MainView has no Toolbar.')
124
def test_close_toolbar_without_toolbar(self):
125
error = self.assertRaises(
126
ubuntuuitoolkit.ToolkitException, self.main_view.close_toolbar)
128
str(error), 'The MainView has no Toolbar.')
80
131
TEST_GO_BACK_QML_FORMAT = ("""
81
132
import QtQuick 2.0
82
133
import Ubuntu.Components 1.0