Skip to content

Commit

Permalink
[SUTK] Fixed segfault in NotebookTest if there are no tabs in the Not…
Browse files Browse the repository at this point in the history
…ebook; Also set minSize equal to prefSize for tabs
  • Loading branch information
ravi688 committed Jan 6, 2025
1 parent 0c8787e commit fd39326
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sutk/source/NotebookView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ namespace SUTK
m_tabBar->lockLayout();
m_tabView->setLabel(str);
LayoutAttributes attr = m_tabView->getLayoutAttributes();
attr.minSize.width = TAB_VIEW_MIN_WIDTH;
attr.prefSize.width = std::max(TAB_VIEW_MIN_WIDTH, m_tabView->getSize().width);
attr.minSize.width = attr.prefSize.width;
m_tabView->setLayoutAttributes(attr);
m_tabBar->unlockLayout(true);
}
Expand Down
10 changes: 8 additions & 2 deletions sutk/source/tests/NotebookTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,15 @@ namespace SUTK
else if(keyCode == KeyCode::D)
this->m_notebookView->removePage(this->m_notebookView->getCurrentPage());
else if(keyCode == KeyCode::R)
this->m_notebookView->getRootPage()->getNext()->setLabel("Hello World, This is New Year");
{
if(this->m_notebookView->getRootPage())
this->m_notebookView->getRootPage()->getNext()->setLabel("Hello World, This is New Year");
}
else if(keyCode == KeyCode::T)
this->m_notebookView->getRootPage()->getNext()->setLabel("I really wanna solve world's greatest challenges!");
{
if(this->m_notebookView->getRootPage())
this->m_notebookView->getRootPage()->getNext()->setLabel("I really wanna solve world's greatest challenges!");
}
this->m_notebookView->dump();
}
});
Expand Down

0 comments on commit fd39326

Please sign in to comment.