~fboucault/ubuntu-ui-toolkit/progression_visual_lazy

« back to all changes in this revision

Viewing changes to tests/unit/visual/gallery.qml

  • Committer: Tarmac
  • Author(s): Christian Dywan
  • Date: 2016-06-08 13:54:44 UTC
  • mfrom: (1994.1.1 uut.visualGallery)
  • Revision ID: tarmac-20160608135444-c8g1ksv4gq1c1ykz
Introduce gallery for browsing visual tests.

Approved by ubuntu-sdk-build-bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2016 Canonical Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
import QtQuick 2.4
 
18
import Ubuntu.Components 1.3
 
19
import Qt.labs.folderlistmodel 2.1
 
20
 
 
21
MainView {
 
22
    width: units.gu(120)
 
23
    height: units.gu(75)
 
24
 
 
25
    AdaptivePageLayout {
 
26
        id: pageLayout
 
27
        anchors.fill: parent
 
28
        primaryPage: Page {
 
29
            header: PageHeader {
 
30
                flickable: testsListView
 
31
                title: 'Unit Tests'
 
32
            }
 
33
 
 
34
            UbuntuListView {
 
35
                id: testsListView
 
36
                anchors.fill: parent
 
37
                model: FolderListModel {
 
38
                    Component.onCompleted: folder += '/tests/unit/visual'
 
39
                    showDirs: false
 
40
                    showOnlyReadable: true
 
41
                    sortField: FolderListModel.Name
 
42
                    nameFilters: [ "tst_*13.qml" ]
 
43
                }
 
44
 
 
45
                delegate: ListItem {
 
46
                    height: listItemLayout.height
 
47
                    ListItemLayout {
 
48
                        id: listItemLayout
 
49
                        title.text: fileBaseName
 
50
                        ProgressionSlot {}
 
51
                    }
 
52
                    onClicked: pageLayout.addPageToNextColumn(pageLayout.primaryPage, testPage, { source: fileURL, title: fileBaseName })
 
53
                }
 
54
            }
 
55
        }
 
56
        asynchronous: false
 
57
 
 
58
        Page {
 
59
            id: testPage
 
60
            property alias source: testLoader.source
 
61
            header: PageHeader {
 
62
                id: testPageHeader
 
63
                title: testPage.title
 
64
            }
 
65
 
 
66
            Loader {
 
67
                id: testLoader
 
68
                anchors.fill: parent
 
69
                anchors.topMargin: testPage.header.height
 
70
                asynchronous: false
 
71
            }
 
72
        }
 
73
    }
 
74
}
 
75