| 90 | } |
| 91 | |
| 92 | void 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 |
no test coverage detected