8000
Skip to content
Open
10 changes: 10 additions & 0 deletions application/testing/tests.features.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -789,3 +789,13 @@ if(NOT WIN32)
f3d_test(NAME TestOutputWithExistingReferenceTooLong DATA suzanne.ply ARGS --reference=${F3D_SOURCE_DIR}/testing/data/world.png --output=${_f3d_test_invalid_folder}/file.ext REGEXP "File name too long" NO_BASELINE NO_OUTPUT)
f3d_test(NAME TestConfigTooLong CONFIG ${_f3d_test_invalid_folder}/invalid.json REGEXP "File name too long" NO_RENDER NO_BASELINE)
endif()

if(F3D_MODULE_UI)
f3d_test(NAME TestFPS DATA suzanne.ply ARGS -z --font-scale=0.35
--font-file=${F3D_SOURCE_DIR}/testing/data/Crosterian.ttf UI THRESHOLD 0.2)
# Require improved importer support https://gitlab.kitware.com/vtk/vtk/-/merge_requests/11303
if(VTK_VERSION VERSION_GREATER_EQUAL 9.3.20240910)
f3d_test(NAME TestFPSWithBadge DATA invalid_body.vtp ARGS -z --font-scale=0.35
--font-file=${F3D_SOURCE_DIR}/testing/data/Crosterian.ttf NO_DATA_FORCE_RENDER UI NO_BASELINE)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why NO_RENDER NO_BASELINE ? testing visually the UI placement would be nice imo.

endif()
endif()
3 changes: 3 additions & 0 deletions testing/baselines/TestFPS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions vtkext/private/module/vtkF3DImguiActor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1137,8 +1137,17 @@ void vtkF3DImguiActor::RenderFpsCounter()
winSize.x += 2.f * ImGui::GetStyle().WindowPadding.x;
winSize.y += 2.f * ImGui::GetStyle().WindowPadding.y;

ImVec2 position(
viewport->WorkSize.x - winSize.x - margin, viewport->WorkSize.y - winSize.y - margin);
float posX = viewport->WorkSize.x - winSize.x - margin;
if (this->ConsoleBadgeEnabled)
{
vtkF3DImguiConsole* console = vtkF3DImguiConsole::SafeDownCast(vtkOutputWindow::GetInstance());
if (console && console->IsBadgeVisible())
{
ImVec2 badgeSize = console->GetBadgeSize();
posX = viewport->WorkSize.x - winSize.x - badgeSize.x - 2.f * margin;
}
}
ImVec2 position(posX, margin);

::SetupNextWindow(position, winSize);
ImGui::SetNextWindowBgAlpha(this->BackdropOpacity);
Expand Down
6 changes: 6 additions & 0 deletions vtkext/private/module/vtkF3DImguiConsole.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,12 @@ void vtkF3DImguiConsole::ShowBadge()
}
}

//----------------------------------------------------------------------------
bool vtkF3DImguiConsole::IsBadgeVisible() const
{
return this->Pimpl->NewError || this->Pimpl->NewWarning;
}

//----------------------------------------------------------------------------
ImVec2 vtkF3DImguiConsole::GetBadgeSize()
{
Expand Down
5 changes: 5 additions & 0 deletions vtkext/private/module/vtkF3DImguiConsole.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ class vtkF3DImguiConsole : public vtkF3DConsoleOutputWindow
*/
void ShowBadge();

/**
* Return true if the console badge is visible, false otherwise
*/
bool IsBadgeVisible() const;

/**
* Clear console
*/
Expand Down
Loading
0