diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2019-01-10 09:02:56 +0100 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2019-01-17 07:21:17 +0000 |
commit | b8d6d07482e9139b74c3237e30b11b0431b632ba (patch) | |
tree | 6c14dcb30cd04de925b6ddebc23d456c8eefa4fb /tests/auto/client/shared/coreprotocol.h | |
parent | 640c04b8ba86223c5e13734b8bbc91cce91291a4 (diff) |
Client: Add wl_output tests
Also removes overlapping old tests and adds a (currently failing) test for
QTBUG-72828.
Task-number: QTBUG-72828
Change-Id: Id93d5872ed1c4f181935c1e493e9d8d0ae9cfaf3
Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
Diffstat (limited to 'tests/auto/client/shared/coreprotocol.h')
-rw-r--r-- | tests/auto/client/shared/coreprotocol.h | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/tests/auto/client/shared/coreprotocol.h b/tests/auto/client/shared/coreprotocol.h index 2fbe9b139..565ae66ae 100644 --- a/tests/auto/client/shared/coreprotocol.h +++ b/tests/auto/client/shared/coreprotocol.h @@ -171,20 +171,59 @@ public: // TODO }; +struct OutputMode { + explicit OutputMode() = default; + explicit OutputMode(const QSize &resolution, int refreshRate = 60000) + : resolution(resolution), refreshRate(refreshRate) + {} + QSize resolution = QSize(1920, 1080); + int refreshRate = 60000; // In mHz + //TODO: flags (they're currently hard-coded) + + // in mm + QSize physicalSizeForDpi(int dpi) { return (QSizeF(resolution) * 25.4 / dpi).toSize(); } +}; + +struct OutputData { + using Subpixel = QtWaylandServer::wl_output::subpixel; + using Transform = QtWaylandServer::wl_output::transform; + explicit OutputData() = default; + + // for geometry event + QPoint position; + QSize physicalSize = QSize(0, 0); // means unknown physical size + QString make = "Make"; + QString model = "Model"; + Subpixel subpixel = Subpixel::subpixel_unknown; + Transform transform = Transform::transform_normal; + + int scale = 1; // for scale event + OutputMode mode; // for mode event +}; + class Output : public Global, public QtWaylandServer::wl_output { Q_OBJECT public: - explicit Output(CoreCompositor *compositor, int scale = 1, int version = 2) + explicit Output(CoreCompositor *compositor, OutputData data = OutputData(), int version = 2) : QtWaylandServer::wl_output(compositor->m_display, version) - , m_scale(scale) + , m_data(std::move(data)) , m_version(version) {} - void sendScale(int factor); + + void send_geometry() = delete; + void sendGeometry(); + void sendGeometry(Resource *resource); // Sends to only one client + void send_scale(int32_t factor) = delete; - void send_scale(struct ::wl_resource *resource, int32_t factor) = delete; + void sendScale(int factor); + void sendScale(Resource *resource); // Sends current scale to only one client + void sendDone(); - int m_scale = 1; + + int scale() const { return m_data.scale; } + + OutputData m_data; int m_version = 1; // TODO: remove on libwayland upgrade protected: |