2
* Copyright (C) 2014 Canonical, Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; version 3.
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 General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
import Ubuntu.Components 0.1
20
import Unity.Test 0.1 as UT
21
import "../../../qml/Dash"
22
import "CardHelpers.js" as Helpers
30
property string cardData: '
32
"art": "../../tests/qmltests/Dash/artwork/music-player-design.png",
33
"mascot": "../../tests/qmltests/Dash/artwork/avatar.png",
36
"summary": "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
39
property string currentModel: '{}'
40
property string cardTitleArtSubtitleMascotSummaryModel: '{ "components": { "title": "title", "art": "art", "subtitle": "subtitle", "mascot": "mascot", "summary": "summary" } }'
41
property string cardTitleArtSubtitleMascotModel: '{ "components": { "title": "title", "art": "art", "subtitle": "subtitle", "mascot": "mascot" } }'
42
property string cardTitleArtSubtitleModel: '{ "components": { "title": "title", "art": "art", "subtitle": "subtitle" } }'
43
property string cardTitleArtModel: '{ "components": { "title": "title", "art": "art" } }'
44
property string cardArtModel: '{ "components": { "art": "art" } }'
45
property string cardTitleModel: '{ "components": { "title": "title" } }'
49
template: Helpers.update(JSON.parse(Helpers.defaultLayout), JSON.parse(currentModel))['template'];
50
components: Helpers.update(JSON.parse(Helpers.defaultLayout), JSON.parse(currentModel))['components'];
51
viewWidth: units.gu(48)
58
width: cardTool.cardWidth || implicitWidth
59
height: cardTool.cardHeight || implicitHeight
61
template: cardTool.template
62
components: cardTool.components
63
cardData: Helpers.mapData(root.cardData, components)
77
function benchmark_time_data() {
79
{ tag: "cardTitleArtSubtitleMascotSummaryModel", model: cardTitleArtSubtitleMascotSummaryModel },
80
{ tag: "cardTitleArtSubtitleMascotModel", model: cardTitleArtSubtitleMascotModel },
81
{ tag: "cardTitleArtSubtitleModel", model: cardTitleArtSubtitleModel },
82
{ tag: "cardTitleArtModel", model: cardTitleArtModel },
83
{ tag: "cardArtModel", model: cardArtModel },
84
{ tag: "cardTitleModel", model: cardTitleModel },
88
function benchmark_time(data) {
89
currentModel = data.model;
90
cardRepeater.model = 1;
91
cardRepeater.model = 0;