Commit 5f4b6b87 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

vtkSMViewResolutionDomain: use correct size value

vtkSMViewResolutionDomain was incorrectly preferring to use the size set
on the `PreviewMode` property even when single view was selected. This
was causing BUG #19024. Fixed that.

Fixes #19024. Extending Preview test to test the same.
parent cd0ea8b2
75e4b850a2b10f97c368ad15a4e2c45146324d0ce30364f4a24f5d7f13e30902cc7352542727468da2d6ea7e7610415291ee92023036e03a9a29e43307725c8f
125d4f015107fe8422ac0e48899fcfe2a4c9af4f4a4a6b367eba510cc058f1e5b6abb2eaeed53f57de7001a508e85a2adc054bde6ad8d7ddf6a3c6a01c8d1bf9
......@@ -250,7 +250,10 @@ ExternalData_Expand_Arguments(ParaViewData _
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/PartitionedDataSetCollection_Surface.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/PLYWriter.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/PointGaussianScaleOpacityArrayA.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/PointGaussianScaleOpacityArrayA.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/PolyLineSourceInterA.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/Preview-SingleView.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/Preview-AllViews.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/PythonAlgorithmPlugin.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/PythonAlgorithmReadersAndWriters.png}"
"DATA{${CMAKE_CURRENT_SOURCE_DIR}/../Data/Baseline/QuartilePlotArea.png}"
......@@ -405,7 +408,6 @@ SET (TESTS_WITHOUT_BASELINES
OpenHelp.xml
PartialArrayInLineChart.xml
PointCellDataConversion.xml
Preview.xml
ReloadCGNSFile.xml
SearchBox.xml
ServerConnectDialog.xml
......@@ -459,6 +461,7 @@ SET (TESTS_WITH_INLINE_COMPARES
NonlinearSubdivisionDisplay.xml
PartitionedDataSet.xml
PartitionedDataSetCollection.xml
Preview.xml
QuartilePlot.xml
ReadPartitionedCGNS.xml
RectilinearFractal.xml
......
......@@ -30,4 +30,53 @@
<pqevent object="pqClientMainWindow/menubar/menu_View/Preview" command="activate" arguments="400 x 400 (Custom)" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container" command="size" arguments="400,400" />
<!-- exit preview mode -->
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menu_View" />
<pqevent object="pqClientMainWindow/menubar/menu_View" command="activate" arguments="Preview" />
<pqevent object="pqClientMainWindow/menubar/menu_View/Preview" command="activate" arguments="400 x 400 (Custom)" />
<!-- setup a new visualization with 2 views and annotations -->
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.2/Close" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.0/SplitHorizontal" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.2/CentralWidgetFrame/EmptyView/scrollArea/qt_scrollarea_viewport/widgetFoo/ConvertActionsFrame/RenderView" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuSources" />
<pqevent object="pqClientMainWindow/menubar/menuSources/Alphabetical" command="activate" arguments="RTAnalyticSource" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/representationToolbar/displayRepresentation/comboBox" command="activated" arguments="Surface" />
<pqevent object="pqClientMainWindow/variableToolbar/displayColor/Variables" command="activated" arguments="RTData" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.1/TitleBar/TitleLabel" command="mousePress" arguments="1,1,0,48,13" />
<pqevent object="pqClientMainWindow/centralwidget/MultiViewWidget/CoreWidget/qt_tabwidget_stackedwidget/MultiViewWidget1/Container/Frame.1/TitleBar/TitleLabel" command="mouseRelease" arguments="1,0,0,58,13" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mousePress" arguments="1,1,0,7,7,/0:0/0:1" />
<pqevent object="pqClientMainWindow/pipelineBrowserDock/pipelineBrowser" command="mouseRelease" arguments="1,0,0,7,7,/0:0/0:1" />
<pqevent object="pqClientMainWindow/variableToolbar/displayColor/Variables" command="activated" arguments="RTData" />
<pqevent object="pqClientMainWindow/representationToolbar/displayRepresentation/comboBox" command="activated" arguments="Surface With Edges" />
<pqevent object="pqClientMainWindow/representationToolbar/displayRepresentation/comboBox" command="activated" arguments="Surface" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuSources" />
<pqevent object="pqClientMainWindow/menubar/menuSources/Alphabetical" command="activate" arguments="TextSource" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />
<!-- enter preview mode -->
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menu_View" />
<pqevent object="pqClientMainWindow/menubar/menu_View/Preview" command="activate" arguments="400 x 400 (Custom)" />
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menu_File" />
<!-- save single view screenshot toggling SaveAllViews checkbox to test #19024 -->
<pqevent object="pqClientMainWindow/menubar/menu_File" command="activate" arguments="actionFileSaveScreenshot" />
<pqevent object="pqClientMainWindow/SaveScreenshotFileDialog" command="filesSelected" arguments="$PARAVIEW_TEST_ROOT/preview-singleview.test.png" />
<pqevent object="pqClientMainWindow/SaveScreenshotDialog/scrollArea/qt_scrollarea_viewport/Container/ProxyWidget/SaveAllViews/CheckBox" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/SaveScreenshotDialog/scrollArea/qt_scrollarea_viewport/Container/ProxyWidget/SaveAllViews/CheckBox" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/SaveScreenshotDialog/scrollArea/qt_scrollarea_viewport/Container/ProxyWidget/SaveAllViews/CheckBox" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/SaveScreenshotDialog/widget/OKButton" command="activate" arguments="" />
<pqcompareimage image="$PARAVIEW_TEST_ROOT/preview-singleview.test.png" baseline="$PARAVIEW_DATA_ROOT/Applications/ParaView/Testing/Data/Baseline/Preview-SingleView.png" />
<!-- save all views -->
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menu_File" />
<pqevent object="pqClientMainWindow/menubar/menu_File" command="activate" arguments="actionFileSaveScreenshot" />
<pqevent object="pqClientMainWindow/SaveScreenshotFileDialog" command="filesSelected" arguments="$PARAVIEW_TEST_ROOT/preview-allviews.test.png" />
<pqevent object="pqClientMainWindow/SaveScreenshotDialog/scrollArea/qt_scrollarea_viewport/Container/ProxyWidget/SaveAllViews/CheckBox" command="set_boolean" arguments="false" />
<pqevent object="pqClientMainWindow/SaveScreenshotDialog/scrollArea/qt_scrollarea_viewport/Container/ProxyWidget/ImageResolution/reset" command="activate" arguments="" />
<pqevent object="pqClientMainWindow/SaveScreenshotDialog/scrollArea/qt_scrollarea_viewport/Container/ProxyWidget/SaveAllViews/CheckBox" command="set_boolean" arguments="true" />
<pqevent object="pqClientMainWindow/SaveScreenshotDialog/widget/OKButton" command="activate" arguments="" />
<pqcompareimage image="$PARAVIEW_TEST_ROOT/preview-allviews.test.png" baseline="$PARAVIEW_DATA_ROOT/Applications/ParaView/Testing/Data/Baseline/Preview-AllViews.png" />
</pqevents>
......@@ -38,33 +38,19 @@ void vtkSMViewResolutionDomain::Update(vtkSMProperty*)
vtkSMProperty* viewProperty = this->GetRequiredProperty("View");
int resolution[2] = { 0, 0 };
// First try to use the PreviewMode property in the vtkSMViewLayoutProxy
if (layoutProperty)
if (useLayoutProperty && vtkSMUncheckedPropertyHelper(useLayoutProperty).GetAsInt() != 0)
{
if (auto layout = vtkSMViewLayoutProxy::SafeDownCast(
vtkSMUncheckedPropertyHelper(layoutProperty).GetAsProxy(0)))
{
vtkSMUncheckedPropertyHelper(layout, "PreviewMode").Get(resolution, 2);
}
this->GetLayoutResolution(vtkSMViewLayoutProxy::SafeDownCast(
vtkSMUncheckedPropertyHelper(layoutProperty).GetAsProxy(0)),
resolution);
}
// If the PreviewMode property is not set because we were not in preview mode,
// then use the extent or view size
if (resolution[0] == 0 && resolution[1] == 0)
else if (viewProperty)
{
if (useLayoutProperty && vtkSMUncheckedPropertyHelper(useLayoutProperty).GetAsInt() != 0)
{
this->GetLayoutResolution(vtkSMViewLayoutProxy::SafeDownCast(
vtkSMUncheckedPropertyHelper(layoutProperty).GetAsProxy(0)),
resolution);
}
else if (viewProperty)
{
this->GetViewResolution(
vtkSMViewProxy::SafeDownCast(vtkSMUncheckedPropertyHelper(viewProperty).GetAsProxy(0)),
resolution);
}
this->GetViewResolution(
vtkSMViewProxy::SafeDownCast(vtkSMUncheckedPropertyHelper(viewProperty).GetAsProxy(0)),
resolution);
}
if (resolution[0] != 0 && resolution[1] != 0)
{
std::vector<vtkEntry> values;
......@@ -79,9 +65,14 @@ void vtkSMViewResolutionDomain::GetLayoutResolution(vtkSMViewLayoutProxy* layout
{
if (layout)
{
auto size = layout->GetSize();
resolution[0] = size[0];
resolution[1] = size[1];
// for layout size, prefer preview mode size, if non-empty.
vtkSMUncheckedPropertyHelper(layout, "PreviewMode").Get(resolution, 2);
if (resolution[0] == 0 || resolution[1] == 0)
{
auto size = layout->GetSize();
resolution[0] = size[0];
resolution[1] = size[1];
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment