Warning, /frameworks/kquickcharts/autotests/tst_PieChart.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * This file is part of KQuickCharts 0003 * SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 0008 import QtQuick 0009 import QtTest 0010 0011 import org.kde.quickcharts as Charts 0012 0013 TestCase { 0014 id: testCase 0015 name: "Pie Chart Tests" 0016 0017 width: 400 0018 height: 400 0019 visible: true 0020 when: windowShown 0021 0022 Component { 0023 id: minimal 0024 Charts.PieChart { } 0025 } 0026 0027 Component { 0028 id: simple 0029 Charts.PieChart { 0030 width: 200 0031 height: 200 0032 nameSource: Charts.ArraySource { array: ["Test 1", "Test 2", "Test 3"] } 0033 colorSource: Charts.ArraySource { array: ["red", "green", "blue"] } 0034 valueSources: Charts.ArraySource { array: [1, 2, 3, 4, 5] } 0035 } 0036 } 0037 0038 Component { 0039 id: multiValue 0040 Charts.PieChart { 0041 width: 200 0042 height: 200 0043 nameSource: Charts.ArraySource { array: ["Test 1", "Test 2", "Test 3"] } 0044 colorSource: Charts.ArraySource { array: ["red", "green", "blue"] } 0045 valueSources: [ 0046 Charts.ArraySource { array: [1, 2, 3, 4, 5] }, 0047 Charts.ArraySource { array: [1, 2, 3, 4, 5] }, 0048 Charts.ArraySource { array: [1, 2, 3, 4, 5] } 0049 ] 0050 } 0051 } 0052 0053 Component { 0054 id: model 0055 Charts.PieChart { 0056 width: 200 0057 height: 200 0058 0059 valueSources: [ 0060 Charts.ModelSource { 0061 model: ListModel { 0062 id: listModel 0063 ListElement { name: "Test 1"; color: "red"; value: 1 } 0064 ListElement { name: "Test 2"; color: "green"; value: 2 } 0065 ListElement { name: "Test 3"; color: "blue"; value: 3 } 0066 ListElement { name: "Test 4"; color: "cyan"; value: 4 } 0067 ListElement { name: "Test 5"; color: "magenta"; value: 5 } 0068 ListElement { name: "Test 6"; color: "yellow"; value: 6 } 0069 } 0070 } 0071 ] 0072 nameSource: Charts.ModelSource { model: listModel; roleName: "name" } 0073 colorSource: Charts.ModelSource { model: listModel; roleName: "color" } 0074 } 0075 } 0076 0077 function test_create_data() { 0078 return [ 0079 { tag: "minimal", component: minimal }, 0080 { tag: "simple", component: simple }, 0081 { tag: "multiValue", component: multiValue }, 0082 { tag: "model", component: model } 0083 ] 0084 } 0085 0086 function test_create(data) { 0087 var item = createTemporaryObject(data.component, testCase) 0088 verify(item) 0089 verify(waitForRendering(item)) 0090 } 0091 } 0092