mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-05 23:07:42 -05:00
Merge commit godotengine/godot@71a9948157
This commit is contained in:
@@ -53,7 +53,8 @@ TEST_CASE("[SceneTree][TabBar] tab operations") {
|
||||
CHECK(tab_bar->get_previous_tab() == -1);
|
||||
}
|
||||
|
||||
SUBCASE("[TabBar] add tabs") {
|
||||
SUBCASE("[TabBar] add tabs disallowing deselection") {
|
||||
tab_bar->set_deselect_enabled(false);
|
||||
tab_bar->add_tab("tab0");
|
||||
CHECK(tab_bar->get_tab_count() == 1);
|
||||
CHECK(tab_bar->get_current_tab() == 0);
|
||||
@@ -94,6 +95,23 @@ TEST_CASE("[SceneTree][TabBar] tab operations") {
|
||||
CHECK_FALSE(tab_bar->is_tab_hidden(2));
|
||||
}
|
||||
|
||||
SUBCASE("[TabBar] add tabs allowing deselection") {
|
||||
tab_bar->set_deselect_enabled(true);
|
||||
tab_bar->add_tab("tab0");
|
||||
CHECK(tab_bar->get_tab_count() == 1);
|
||||
CHECK(tab_bar->get_current_tab() == -1);
|
||||
CHECK(tab_bar->get_previous_tab() == -1);
|
||||
SIGNAL_CHECK_FALSE("tab_selected");
|
||||
SIGNAL_CHECK_FALSE("tab_changed");
|
||||
|
||||
tab_bar->add_tab("tab1");
|
||||
CHECK(tab_bar->get_tab_count() == 2);
|
||||
CHECK(tab_bar->get_current_tab() == -1);
|
||||
CHECK(tab_bar->get_previous_tab() == -1);
|
||||
SIGNAL_CHECK_FALSE("tab_selected");
|
||||
SIGNAL_CHECK_FALSE("tab_changed");
|
||||
}
|
||||
|
||||
SUBCASE("[TabBar] set tab count") {
|
||||
// Adds multiple tabs at once.
|
||||
tab_bar->set_tab_count(3);
|
||||
@@ -322,7 +340,7 @@ TEST_CASE("[SceneTree][TabBar] tab operations") {
|
||||
SIGNAL_CHECK("tab_selected", { { -1 } });
|
||||
SIGNAL_CHECK("tab_changed", { { -1 } });
|
||||
|
||||
// Adding a tab will still set the current tab to 0.
|
||||
// Adding first tab will NOT change the current tab. (stays deselected)
|
||||
tab_bar->clear_tabs();
|
||||
CHECK(tab_bar->get_current_tab() == -1);
|
||||
CHECK(tab_bar->get_previous_tab() == -1);
|
||||
@@ -331,10 +349,10 @@ TEST_CASE("[SceneTree][TabBar] tab operations") {
|
||||
tab_bar->add_tab("tab1");
|
||||
tab_bar->add_tab("tab2");
|
||||
CHECK(tab_bar->get_tab_count() == 3);
|
||||
CHECK(tab_bar->get_current_tab() == 0);
|
||||
CHECK(tab_bar->get_current_tab() == -1);
|
||||
CHECK(tab_bar->get_previous_tab() == -1);
|
||||
SIGNAL_CHECK("tab_selected", { { 0 } });
|
||||
SIGNAL_CHECK("tab_changed", { { 0 } });
|
||||
SIGNAL_CHECK_FALSE("tab_selected");
|
||||
SIGNAL_CHECK_FALSE("tab_changed");
|
||||
|
||||
tab_bar->set_current_tab(-1);
|
||||
SIGNAL_DISCARD("tab_selected");
|
||||
@@ -804,10 +822,11 @@ TEST_CASE("[SceneTree][TabBar] layout and offset") {
|
||||
MessageQueue::get_singleton()->flush();
|
||||
CHECK(tab_bar->get_tab_offset() == 0);
|
||||
|
||||
// Horizontal size and minimum size get set to 0.
|
||||
CHECK(tab_bar->get_minimum_size().x == 0);
|
||||
// Horizontal size and minimum size get set to the widest tab plus arrow icons.
|
||||
const float offset_button_size = tab_bar->get_theme_icon("decrement_icon")->get_width() + tab_bar->get_theme_icon("increment_icon")->get_width();
|
||||
CHECK(tab_bar->get_minimum_size().x == offset_button_size + MAX(tab_rects[0].size.x, MAX(tab_rects[1].size.x, tab_rects[2].size.x)));
|
||||
CHECK(tab_bar->get_minimum_size().y == all_tabs_size.y);
|
||||
CHECK(tab_bar->get_size().x == 0);
|
||||
CHECK(tab_bar->get_size().x == offset_button_size + MAX(tab_rects[0].size.x, MAX(tab_rects[1].size.x, tab_rects[2].size.x)));
|
||||
CHECK(tab_bar->get_size().y == all_tabs_size.y);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
#include "modules/modules_enabled.gen.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/editor_paths.h"
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/file_system/editor_paths.h"
|
||||
#include "editor/settings/editor_settings.h"
|
||||
#endif // TOOLS_ENABLED
|
||||
|
||||
#include "tests/core/config/test_project_settings.h"
|
||||
|
||||
Reference in New Issue
Block a user