/** * @RDE_HEADER@ * RtStateTest * $Id$ * $HeadURL$ * $Author$ * Created by Christian Fröbel, NLE, 2018-12-16 */ #include "rt_state_test.h" #include #include #include using namespace AudioVideoManagement; namespace { QVector radioCircuits() { return {{RadioSystem::Tvc, 1, "tvc 1"}, {RadioSystem::Tvc, 2, "tvc 2"}, {RadioSystem::Cnr, 1, "cnr 1"}}; } } // anonymous namespace void RtStateTest::testInitialState() { RtState rtState; rtState.setRadioCircuits(radioCircuits()); QCOMPARE(rtState.toCommand(), std::string(R"(setRtProfile "Default" "15 0 {cnr 1} 15 0 {tvc 1} 15 0 {tvc 2} " "{tvc 1} {tvc 2} {cnr 1} {} {} {} {} {} " "1 1 1 1 1 1 1 1 " 1)")); } void RtStateTest::testVolume() { RtState rtState; rtState.setRadioCircuits(radioCircuits()); rtState.setVolume("tvc 2", AvaVolume(5)); QCOMPARE(rtState.toCommand(), std::string(R"(setRtProfile "Default" "15 0 {cnr 1} 15 0 {tvc 1} 15 5 {tvc 2} " "{tvc 1} {tvc 2} {cnr 1} {} {} {} {} {} " "1 1 1 1 1 1 1 1 " 1)")); } void RtStateTest::testNewProfile() { RtState rtState; rtState.setRadioCircuits(radioCircuits()); rtState.setVolume("tvc 2", AvaVolume(5)); rtState.setVolume("cnr 1", AvaVolume(-3)); rtState.setSelection(AvaRtPos(2), "tvc 2", AvaRtButtonState::Left); rtState.setSelection(AvaRtPos(3), "cnr 1", AvaRtButtonState::Both); rtState.setRadioCircuits({{RadioSystem::Tvc, 2, "tvc 2"}, {RadioSystem::Cnr, 1, "cnr 1"}, {RadioSystem::Cnr, 2, "cnr 2"}}); QCOMPARE(rtState.toCommand(), std::string(R"(setRtProfile "Default" "15 -3 {cnr 1} 15 0 {cnr 2} 15 5 {tvc 2} " "{tvc 2} {cnr 1} {cnr 2} {} {} {} {} {} " "2 4 1 1 1 1 1 1 " 1)")); } void RtStateTest::testSelection() { RtState rtState; rtState.setRadioCircuits(radioCircuits()); rtState.setSelection(AvaRtPos(1), "", AvaRtButtonState::None); // de-select rtState.setSelection(AvaRtPos(2), "", AvaRtButtonState::None); // de-select rtState.setSelection(AvaRtPos(3), "cnr 1", AvaRtButtonState::Both); rtState.setSelection(AvaRtPos(8), "tvc 1", AvaRtButtonState::Right); QCOMPARE(rtState.toCommand(), std::string(R"(setRtProfile "Default" "15 0 {cnr 1} 15 0 {tvc 1} 15 0 {tvc 2} " "{} {} {cnr 1} {} {} {} {} {tvc 1} " "1 1 4 1 1 1 1 3 " 1)")); } void RtStateTest::testChangeName() { RtState rtState; rtState.setRadioCircuits(radioCircuits()); rtState.changeName({RadioSystem::Tvc, 2, "TVC_2"}); QCOMPARE(rtState.toCommand(), std::string(R"(setRtProfile "Default" "15 0 {cnr 1} 15 0 {tvc 1} 15 0 {TVC_2} " "{tvc 1} {TVC_2} {cnr 1} {} {} {} {} {} " "1 1 1 1 1 1 1 1 " 1)")); } void RtStateTest::testSumChannel() { RtState rtState; rtState.setRadioCircuits(radioCircuits()); rtState.setSumChannel(AvaSumChannel::Left); QCOMPARE(rtState.toCommand(), std::string(R"(setRtProfile "Default" "15 0 {cnr 1} 15 0 {tvc 1} 15 0 {tvc 2} " "{tvc 1} {tvc 2} {cnr 1} {} {} {} {} {} " "1 1 1 1 1 1 1 1 " 2)")); }