Do not assert when preferred{Width|Height} is infinity

This adds an autotest for the fix that landed in qtbase:
(2a95ecf7e81fbdcfad50f8a1dd5c62b120e2ec27)

Task-number: QTBUG-116577
Pick-to: 6.7 6.6 6.5
Change-Id: I143f969596c6ee7ccd3d8607cfa53d539566a0b5
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
This commit is contained in:
Jan Arve Sæther 2023-12-20 11:48:39 +01:00
parent 27300f19d1
commit 4b4bca359b
1 changed files with 13 additions and 1 deletions

View File

@ -945,7 +945,19 @@ Item {
},
layoutWidth: 0,
expectedWidths: [0]
}
},{
tag: "preferred_infinity", // Do not crash/assert when the preferred size is infinity
layout: {
type: "RowLayout",
items: [
{minimumWidth: 10, preferredWidth: Number.POSITIVE_INFINITY, fillWidth: true},
{minimumWidth: 20, preferredWidth: Number.POSITIVE_INFINITY, fillWidth: true},
]
},
layoutWidth: 31, // Important that this is between minimum and preferred width of the layout.
expectedWidths: [10, 21] // The result here does not have to be exact. (This
// test is mostly concerned about not crashing).
}
];
}