Changeset View
Changeset View
Standalone View
Standalone View
autotests/client/test_xdg_shell.cpp
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | 31 | { | |||
---|---|---|---|---|---|
71 | Registry registry; | 71 | Registry registry; | ||
72 | QSignalSpy interfacesAnnouncedSpy(®istry, &Registry::interfacesAnnounced); | 72 | QSignalSpy interfacesAnnouncedSpy(®istry, &Registry::interfacesAnnounced); | ||
73 | QVERIFY(interfacesAnnouncedSpy.isValid()); | 73 | QVERIFY(interfacesAnnouncedSpy.isValid()); | ||
74 | QSignalSpy interfaceAnnouncedSpy(®istry, &Registry::interfaceAnnounced); | 74 | QSignalSpy interfaceAnnouncedSpy(®istry, &Registry::interfaceAnnounced); | ||
75 | QVERIFY(interfaceAnnouncedSpy.isValid()); | 75 | QVERIFY(interfaceAnnouncedSpy.isValid()); | ||
76 | QSignalSpy outputAnnouncedSpy(®istry, &Registry::outputAnnounced); | 76 | QSignalSpy outputAnnouncedSpy(®istry, &Registry::outputAnnounced); | ||
77 | QVERIFY(outputAnnouncedSpy.isValid()); | 77 | QVERIFY(outputAnnouncedSpy.isValid()); | ||
78 | 78 | | |||
79 | auto shellAnnouncedSignal = m_version == XdgShellInterfaceVersion::UnstableV5 ? | 79 | auto shellAnnouncedSignal = m_version == XdgShellInterfaceVersion::UnstableV5 ? &Registry::xdgShellUnstableV5Announced : | ||
80 | &Registry::xdgShellUnstableV5Announced : &Registry::xdgShellUnstableV6Announced; | 80 | m_version == XdgShellInterfaceVersion::UnstableV6 ? &Registry::xdgShellUnstableV6Announced : | ||
81 | &Registry::xdgShellStableAnnounced; | ||||
81 | 82 | | |||
82 | QSignalSpy xdgShellAnnouncedSpy(®istry, shellAnnouncedSignal); | 83 | QSignalSpy xdgShellAnnouncedSpy(®istry, shellAnnouncedSignal); | ||
83 | QVERIFY(xdgShellAnnouncedSpy.isValid()); | 84 | QVERIFY(xdgShellAnnouncedSpy.isValid()); | ||
84 | registry.setEventQueue(m_queue); | 85 | registry.setEventQueue(m_queue); | ||
85 | registry.create(m_connection); | 86 | registry.create(m_connection); | ||
86 | QVERIFY(registry.isValid()); | 87 | QVERIFY(registry.isValid()); | ||
87 | registry.setup(); | 88 | registry.setup(); | ||
88 | QVERIFY(interfacesAnnouncedSpy.wait()); | 89 | QVERIFY(interfacesAnnouncedSpy.wait()); | ||
Show All 11 Lines | |||||
100 | QVERIFY(m_compositor->isValid()); | 101 | QVERIFY(m_compositor->isValid()); | ||
101 | 102 | | |||
102 | m_seat = registry.createSeat(registry.interface(Registry::Interface::Seat).name, registry.interface(Registry::Interface::Seat).version, this); | 103 | m_seat = registry.createSeat(registry.interface(Registry::Interface::Seat).name, registry.interface(Registry::Interface::Seat).version, this); | ||
103 | QVERIFY(m_seat); | 104 | QVERIFY(m_seat); | ||
104 | QVERIFY(m_seat->isValid()); | 105 | QVERIFY(m_seat->isValid()); | ||
105 | 106 | | |||
106 | QCOMPARE(xdgShellAnnouncedSpy.count(), 1); | 107 | QCOMPARE(xdgShellAnnouncedSpy.count(), 1); | ||
107 | 108 | | |||
108 | Registry::Interface iface = m_version == XdgShellInterfaceVersion::UnstableV5 ? Registry::Interface::XdgShellUnstableV5 : Registry::Interface::XdgShellUnstableV6; | 109 | Registry::Interface iface; | ||
110 | switch (m_version) { | ||||
111 | case XdgShellInterfaceVersion::UnstableV5: | ||||
112 | iface = Registry::Interface::XdgShellUnstableV5; | ||||
113 | break; | ||||
114 | case XdgShellInterfaceVersion::UnstableV6: | ||||
115 | iface = Registry::Interface::XdgShellUnstableV6; | ||||
116 | break; | ||||
117 | case XdgShellInterfaceVersion::Stable: | ||||
118 | iface = Registry::Interface::XdgShellStable; | ||||
119 | break; | ||||
120 | } | ||||
zzag: Missing `default`. Is it okay if version is unknown? | |||||
IMHO it's better not to as it means we get a compile time warning in the unlikely event that someone adds a new value to the enum without updating this. davidedmundson: IMHO it's better not to as it means we get a compile time warning in the unlikely event that… | |||||
109 | 121 | | |||
110 | m_xdgShell = registry.createXdgShell(registry.interface(iface).name, | 122 | m_xdgShell = registry.createXdgShell(registry.interface(iface).name, | ||
111 | registry.interface(iface).version, | 123 | registry.interface(iface).version, | ||
112 | this); | 124 | this); | ||
113 | QVERIFY(m_xdgShell); | 125 | QVERIFY(m_xdgShell); | ||
114 | QVERIFY(m_xdgShell->isValid()); | 126 | QVERIFY(m_xdgShell->isValid()); | ||
115 | } | 127 | } | ||
116 | 128 | | |||
▲ Show 20 Lines • Show All 447 Lines • Show Last 20 Lines |
Missing default. Is it okay if version is unknown?