{
            {
                let widgets = widgets.clone();
                let tests = Rc::clone(&tests);
                let camera_combo = camera_combo.clone();
                let camera_quality_combo = camera_quality_combo.clone();
                let camera_test_button = widgets.camera_test_button.clone();
                let widgets_handle = widgets.clone();
                camera_test_button.connect_clicked(move |_| {
                    let selected = selected_combo_value(&camera_combo);
                    let quality = selected_camera_quality(&camera_quality_combo);
                    let result = {
                        let mut tests = tests.borrow_mut();
                        let _ = tests.set_camera_selection(selected.as_deref());
                        let _ = tests.set_camera_quality(quality);
                        tests.toggle_camera()
                    };
                    update_test_action_result(
                        &widgets_handle,
                        &mut tests.borrow_mut(),
                        result,
                        "Camera preview started inside the launcher. This stays local until you start the relay.",
                        "Camera preview stopped. The selected camera stays staged for the next launch.",
                    );
                });
            }

            {
                let widgets = widgets.clone();
                let tests = Rc::clone(&tests);
                let camera_mirror_button = widgets.camera_mirror_button.clone();
                camera_mirror_button.connect_toggled(move |button| {
                    tests
                        .borrow_mut()
                        .set_camera_preview_mirrored(button.is_active());
                    button.set_tooltip_text(Some(if button.is_active() {
                        "Launcher preview mirrored."
                    } else {
                        "Mirror launcher preview only."
                    }));
                    if tests.borrow_mut().is_running(DeviceTestKind::Camera) {
                        widgets.status_label.set_text(if button.is_active() {
                            "Launcher webcam preview mirrored. The actual uplink stays untouched."
                        } else {
                            "Launcher webcam preview returned to the real uplink orientation."
                        });
                    }
                });
            }

            {
                let widgets = widgets.clone();
                let tests = Rc::clone(&tests);
                let microphone_combo = microphone_combo.clone();
                let speaker_combo = speaker_combo.clone();
                let microphone_test_button = widgets.microphone_test_button.clone();
                let widgets_handle = widgets.clone();
                microphone_test_button.connect_clicked(move |_| {
                    let mic = selected_combo_value(&microphone_combo);
                    let sink = selected_combo_value(&speaker_combo);
                    let result = tests
                        .borrow_mut()
                        .toggle_microphone(mic.as_deref(), sink.as_deref());
                    update_test_action_result(
                        &widgets_handle,
                        &mut tests.borrow_mut(),
                        result,
                        "Microphone monitor started locally through the selected speaker.",
                        "Microphone monitor stopped.",
                    );
                });
            }

            {
                let widgets = widgets.clone();
                let tests = Rc::clone(&tests);
                let speaker_combo = speaker_combo.clone();
                let microphone_replay_button = widgets.microphone_replay_button.clone();
                let widgets_handle = widgets.clone();
                microphone_replay_button.connect_clicked(move |_| {
                    let result = tests
                        .borrow_mut()
                        .toggle_microphone_replay(selected_combo_value(&speaker_combo).as_deref());
                    update_test_action_result(
                        &widgets_handle,
                        &mut tests.borrow_mut(),
                        result,
                        "Replaying the latest local mic capture through the selected speaker.",
                        "Mic replay stopped.",
                    );
                });
            }

            {
                let widgets = widgets.clone();
                let tests = Rc::clone(&tests);
                let speaker_combo = speaker_combo.clone();
                let speaker_test_button = widgets.speaker_test_button.clone();
                let widgets_handle = widgets.clone();
                speaker_test_button.connect_clicked(move |_| {
                    let result = tests
                        .borrow_mut()
                        .toggle_speaker(selected_combo_value(&speaker_combo).as_deref());
                    update_test_action_result(
                        &widgets_handle,
                        &mut tests.borrow_mut(),
                        result,
                        "Speaker tone started locally.",
                        "Speaker test tone stopped.",
                    );
                });
            }
}
