Fix a fuzzer test

When restoring a layout it can happen that the widget has
different size constraints when being restored, so this warning
was benign. There's a chekcSanity() later, so that's what's matters
This commit is contained in:
Sergio Martins
2020-06-20 14:00:33 +01:00
parent 8b862b7843
commit be4a71685a
2 changed files with 645 additions and 7 deletions

View File

@@ -2154,13 +2154,6 @@ void ItemContainer::updateChildPercentages()
for (Item *item : qAsConst(d->m_children)) {
if (item->isVisible() && !item->isBeingInserted()) {
item->m_sizingInfo.percentageWithinParent = (1.0 * item->length(d->m_orientation)) / usable;
auto p = item->m_sizingInfo.percentageWithinParent;
if (qFuzzyIsNull(p) || p > 1.0) {
root()->dumpLayout();
qWarning() << Q_FUNC_INFO << "Invalid percentage" << p << this
<< "; item=" << item
<< "; item.length=" << item->length(d->m_orientation);
}
} else {
item->m_sizingInfo.percentageWithinParent = 0.0;
}

View File

@@ -0,0 +1,645 @@
{
"initialLayout": {
"dockWidgets": [
{
"geometry": {
"size": {
"height": 807,
"width": 1022
},
"x": 481,
"y": 53
},
"isFloating": false,
"isVisible": true,
"minSize": {
"height": 242,
"width": 459
},
"name": "DockWidget-1"
},
{
"geometry": {
"size": {
"height": 991,
"width": 1097
},
"x": 500,
"y": 373
},
"isFloating": false,
"isVisible": true,
"minSize": {
"height": 537,
"width": 519
},
"name": "DockWidget-2"
},
{
"geometry": {
"size": {
"height": 550,
"width": 856
},
"x": 286,
"y": 486
},
"isFloating": true,
"isVisible": true,
"minSize": {
"height": 319,
"width": 536
},
"name": "DockWidget-3"
},
{
"geometry": {
"size": {
"height": 565,
"width": 840
},
"x": 55,
"y": 69
},
"isFloating": false,
"isVisible": false,
"minSize": {
"height": 179,
"width": 312
},
"name": "DockWidget-4"
},
{
"geometry": {
"size": {
"height": 707,
"width": 1045
},
"x": 195,
"y": 183
},
"isFloating": false,
"isVisible": false,
"minSize": {
"height": 539,
"width": 589
},
"name": "DockWidget-5"
},
{
"geometry": {
"size": {
"height": 555,
"width": 987
},
"x": 406,
"y": 351
},
"isFloating": true,
"isVisible": true,
"minSize": {
"height": 375,
"width": 594
},
"name": "DockWidget-6"
}
],
"mainWindows": [
{
"geometry": {
"size": {
"height": 895,
"width": 126
},
"x": 320,
"y": 109
},
"mainWindowOption": 0,
"name": "MainWindow-1"
}
]
},
"operations": [
{
"comment": "RestoreLayout",
"params": {
},
"type": 7
},
{
"comment": "AddDockWidgetAsTab DockWidget-2 onto DockWidget-6",
"params": {
"dockWidgetName": "DockWidget-6",
"dockWidgetToAddName": "DockWidget-2"
},
"type": 5
},
{
"comment": "Showing DockWidget-6-[hidden]",
"params": {
"dockWidgetName": "DockWidget-6"
},
"type": 3
},
{
"comment": "Hidding DockWidget-2",
"params": {
"dockWidgetName": "DockWidget-2"
},
"type": 2
},
{
"comment": "AddDockWidget DockWidget-5-[hidden] to right",
"params": {
"addingOption": 0,
"dockWidgetName": "DockWidget-5",
"location": 3,
"mainWindowName": "MainWindow-1"
},
"type": 4
},
{
"comment": "SaveLayout",
"params": {
},
"type": 6
},
{
"comment": "Showing DockWidget-2-[hidden]",
"params": {
"dockWidgetName": "DockWidget-2"
},
"type": 3
},
{
"comment": "AddDockWidgetAsTab DockWidget-4-[hidden] onto DockWidget-3",
"params": {
"dockWidgetName": "DockWidget-3",
"dockWidgetToAddName": "DockWidget-4"
},
"type": 5
},
{
"comment": "Hidding DockWidget-6",
"params": {
"dockWidgetName": "DockWidget-6"
},
"type": 2
},
{
"comment": "AddDockWidget DockWidget-6-[hidden] to bottom",
"params": {
"addingOption": 0,
"dockWidgetName": "DockWidget-6",
"location": 4,
"mainWindowName": "MainWindow-1"
},
"type": 4
},
{
"comment": "AddDockWidget DockWidget-4 to right",
"params": {
"addingOption": 0,
"dockWidgetName": "DockWidget-4",
"location": 3,
"mainWindowName": "MainWindow-1"
},
"type": 4
},
{
"comment": "AddDockWidgetAsTab DockWidget-6 onto DockWidget-2",
"params": {
"dockWidgetName": "DockWidget-2",
"dockWidgetToAddName": "DockWidget-6"
},
"type": 5
},
{
"comment": "AddDockWidgetAsTab DockWidget-6 onto DockWidget-5",
"params": {
"dockWidgetName": "DockWidget-5",
"dockWidgetToAddName": "DockWidget-6"
},
"type": 5
},
{
"comment": "SaveLayout",
"params": {
},
"type": 6
},
{
"comment": "Closing DockWidget-3",
"params": {
"dockWidgetName": "DockWidget-3"
},
"type": 1
},
{
"comment": "Closing DockWidget-2",
"params": {
"dockWidgetName": "DockWidget-2"
},
"type": 1
},
{
"comment": "Closing DockWidget-4",
"params": {
"dockWidgetName": "DockWidget-4"
},
"type": 1
},
{
"comment": "RestoreLayout",
"params": {
},
"type": 7
},
{
"comment": "Closing DockWidget-1",
"params": {
"dockWidgetName": "DockWidget-1"
},
"type": 1
},
{
"comment": "AddDockWidgetAsTab DockWidget-1-[hidden] onto DockWidget-2",
"params": {
"dockWidgetName": "DockWidget-2",
"dockWidgetToAddName": "DockWidget-1"
},
"type": 5
},
{
"comment": "Closing DockWidget-1",
"params": {
"dockWidgetName": "DockWidget-1"
},
"type": 1
},
{
"comment": "Showing DockWidget-1-[hidden]",
"params": {
"dockWidgetName": "DockWidget-1"
},
"type": 3
},
{
"comment": "Showing DockWidget-5-[hidden]",
"params": {
"dockWidgetName": "DockWidget-5"
},
"type": 3
},
{
"comment": "AddDockWidgetAsTab DockWidget-3 onto DockWidget-4",
"params": {
"dockWidgetName": "DockWidget-4",
"dockWidgetToAddName": "DockWidget-3"
},
"type": 5
},
{
"comment": "AddDockWidget DockWidget-3 to bottom",
"params": {
"addingOption": 0,
"dockWidgetName": "DockWidget-3",
"location": 4,
"mainWindowName": "MainWindow-1"
},
"type": 4
},
{
"comment": "Closing DockWidget-6",
"params": {
"dockWidgetName": "DockWidget-6"
},
"type": 1
},
{
"comment": "AddDockWidget DockWidget-5 to bottom",
"params": {
"addingOption": 0,
"dockWidgetName": "DockWidget-5",
"location": 4,
"mainWindowName": "MainWindow-1"
},
"type": 4
},
{
"comment": "AddDockWidget DockWidget-6-[hidden] to bottom",
"params": {
"addingOption": 0,
"dockWidgetName": "DockWidget-6",
"location": 4,
"mainWindowName": "MainWindow-1"
},
"type": 4
},
{
"comment": "AddDockWidget DockWidget-6 to right",
"params": {
"addingOption": 0,
"dockWidgetName": "DockWidget-6",
"location": 3,
"mainWindowName": "MainWindow-1"
},
"type": 4
},
{
"comment": "AddDockWidget DockWidget-4 to right",
"params": {
"addingOption": 0,
"dockWidgetName": "DockWidget-4",
"location": 3,
"mainWindowName": "MainWindow-1"
},
"type": 4
},
{
"comment": "RestoreLayout",
"params": {
},
"type": 7
},
{
"comment": "SaveLayout",
"params": {
},
"type": 6
},
{
"comment": "SaveLayout",
"params": {
},
"type": 6
},
{
"comment": "AddDockWidgetAsTab DockWidget-2 onto DockWidget-1",
"params": {
"dockWidgetName": "DockWidget-1",
"dockWidgetToAddName": "DockWidget-2"
},
"type": 5
},
{
"comment": "SaveLayout",
"params": {
},
"type": 6
},
{
"comment": "Closing DockWidget-2",
"params": {
"dockWidgetName": "DockWidget-2"
},
"type": 1
},
{
"comment": "RestoreLayout",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 7
},
{
"comment": "",
"params": {
},
"type": 6
},
{
"comment": "",
"params": {
},
"type": 7
}
]
}