MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / testFloatDockCycle

Function testFloatDockCycle

tests/container_widget_test.cpp:92–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92void testFloatDockCycle()
93{
94 ContainerWidget c("id", "T");
95 auto* body = new QLabel("payload");
96 c.setContent(body);
97
98 QSignalSpy floatSpy(&c, &ContainerWidget::floatRequested);
99 QSignalSpy dockSpy (&c, &ContainerWidget::dockRequested);
100 QSignalSpy modeSpy (&c, &ContainerWidget::dockModeChanged);
101
102 // Simulate clicking the float button. Titlebar emits
103 // floatToggleClicked → ContainerWidget emits floatRequested.
104 emit c.titleBar()->floatToggleClicked();
105 report("floatRequested emitted on titlebar toggle",
106 floatSpy.count() == 1 && dockSpy.count() == 0);
107
108 // Manager would normally move the container into a floating
109 // window; emulate that directly.
110 FloatingContainerWindow win;
111 win.takeContainer(&c);
112 report("takeContainer transitions to Floating",
113 c.isFloating() && win.container() == &c);
114 report("dockMode change signal fired",
115 modeSpy.count() >= 1);
116
117 // Release → back to docked state.
118 ContainerWidget* released = win.releaseContainer();
119 report("releaseContainer returns the same container",
120 released == &c);
121 report("released container is back in PanelDocked mode",
122 c.isPanelDocked());
123 report("window no longer has a container",
124 win.container() == nullptr);
125
126 // When floating, the toggle should emit dockRequested instead.
127 FloatingContainerWindow win2;
128 win2.takeContainer(&c);
129 floatSpy.clear();
130 dockSpy.clear();
131 emit c.titleBar()->floatToggleClicked();
132 report("toggle while floating emits dockRequested",
133 dockSpy.count() == 1 && floatSpy.count() == 0);
134
135 // Cleanup.
136 win2.releaseContainer();
137}
138
139// #3451: a width-capped applet (e.g. Antenna Genius, max 260) should have its
140// cap lifted while floating so it fills the window instead of hugging the left

Callers 1

mainFunction · 0.85

Calls 9

setContentMethod · 0.80
countMethod · 0.80
takeContainerMethod · 0.80
releaseContainerMethod · 0.80
isPanelDockedMethod · 0.80
reportFunction · 0.70
isFloatingMethod · 0.45
containerMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected