Warning, /frameworks/kirigami/autotests/tst_formlayout.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2022 Connor Carney <hello@connorcarney.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.1 0008 import QtQuick.Window 2.0 0009 import QtQuick.Layouts 1.3 0010 import org.kde.kirigami 2.19 as Kirigami 0011 import QtTest 1.0 0012 0013 TestCase { 0014 id: testCase 0015 name: "FormLayout" 0016 0017 Component { 0018 id: fractionalSizeRoundingComponent 0019 Window { 0020 property var item: fractionalSizeItem 0021 width: 600 0022 height: 400 0023 Kirigami.FormLayout { 0024 anchors.fill: parent 0025 Item { 0026 id: fractionalSizeItem 0027 implicitWidth: 160.375 0028 implicitHeight: 17.001 0029 Layout.fillWidth: true 0030 } 0031 } 0032 } 0033 } 0034 0035 function test_fractional_width_rounding() { 0036 let window = fractionalSizeRoundingComponent.createObject(); 0037 let item = window.item; 0038 window.show(); 0039 0040 verify(item.width >= item.implicitWidth, "implicit width should not be rounded down"); 0041 fuzzyCompare(item.width, item.implicitWidth, 1); 0042 0043 window.close(); 0044 } 0045 0046 function test_fractional_height_rounding() { 0047 let window = fractionalSizeRoundingComponent.createObject(); 0048 let item = window.item; 0049 window.show(); 0050 0051 verify(item.height >= item.implicitHeight, "implicit height should not be rounded down"); 0052 fuzzyCompare(item.height, item.implicitHeight, 1); 0053 0054 window.close(); 0055 } 0056 }