summaryrefslogtreecommitdiffstats
path: root/tests/auto/compositor/compositor
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2018-02-27 11:32:15 +0100
committerJohan Helsing <johan.helsing@qt.io>2018-02-27 17:03:41 +0000
commitc4bd9198b4a0fac809903dd2c09276c2c3c1b22e (patch)
tree83325fe11d258c922ede480e0ad3de3df45032fa /tests/auto/compositor/compositor
parent72999738489b5251d025c954a77c93e8e1fdfd9d (diff)
Init variables where they are declared when possible (clang-tidy)
clang-tidy -p compile_commands.json $file \ -checks='-*,modernize-use-default-member-init,readability-redundant-member-init' \ -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' \ -header-filter='qtwayland' \ -fix Afterwards I ran search and replace on the diff to clean up some whitespace errors: - Replaced '(\n\+[^:\n]*)(:\s+\+\s+)' with '$1: ' - Replaced '(\n\+[^,\n]*)(,\s+\+\s+)' with '$1, ' - Replaced '\n\+\s*\n' with '\n' I also had to do some manual edits, because for some reason, this particular clang-tidy check doesn't trigger for some files. Change-Id: I3b3909bac4bf20108bbe8ad1e01bcc54236dae1b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/compositor/compositor')
-rw-r--r--tests/auto/compositor/compositor/mockclient.cpp9
-rw-r--r--tests/auto/compositor/compositor/mockclient.h22
-rw-r--r--tests/auto/compositor/compositor/testcompositor.cpp3
3 files changed, 12 insertions, 22 deletions
diff --git a/tests/auto/compositor/compositor/mockclient.cpp b/tests/auto/compositor/compositor/mockclient.cpp
index 4720b0d9f..e6eac1553 100644
--- a/tests/auto/compositor/compositor/mockclient.cpp
+++ b/tests/auto/compositor/compositor/mockclient.cpp
@@ -47,14 +47,6 @@ const struct wl_registry_listener MockClient::registryListener = {
MockClient::MockClient()
: display(wl_display_connect("wayland-qt-test-0"))
- , compositor(nullptr)
- , registry(nullptr)
- , wlshell(nullptr)
- , xdgShell(nullptr)
- , iviApplication(nullptr)
- , refreshRate(-1)
- , error(0 /* means no error according to spec */)
- , protocolError({0, 0, nullptr})
{
if (!display)
qFatal("MockClient(): wl_display_connect() failed");
@@ -223,7 +215,6 @@ ivi_surface *MockClient::createIviSurface(wl_surface *surface, uint iviId)
}
ShmBuffer::ShmBuffer(const QSize &size, wl_shm *shm)
- : handle(nullptr)
{
int stride = size.width() * 4;
int alloc = stride * size.height();
diff --git a/tests/auto/compositor/compositor/mockclient.h b/tests/auto/compositor/compositor/mockclient.h
index dd50f9a28..8933f8327 100644
--- a/tests/auto/compositor/compositor/mockclient.h
+++ b/tests/auto/compositor/compositor/mockclient.h
@@ -44,7 +44,7 @@ public:
ShmBuffer(const QSize &size, wl_shm *shm);
~ShmBuffer();
- struct wl_buffer *handle;
+ struct wl_buffer *handle = nullptr;
struct wl_shm_pool *shm_pool;
QImage image;
};
@@ -63,29 +63,29 @@ public:
ivi_surface *createIviSurface(wl_surface *surface, uint iviId);
wl_display *display;
- wl_compositor *compositor;
+ wl_compositor *compositor = nullptr;
QMap<uint, wl_output *> m_outputs;
wl_shm *shm;
- wl_registry *registry;
- wl_shell *wlshell;
- xdg_shell *xdgShell;
- ivi_application *iviApplication;
+ wl_registry *registry = nullptr;
+ wl_shell *wlshell = nullptr;
+ xdg_shell *xdgShell = nullptr;
+ ivi_application *iviApplication = nullptr;
QList<MockSeat *> m_seats;
QRect geometry;
QSize resolution;
- int refreshRate;
+ int refreshRate = -1;
QWaylandOutputMode currentMode;
QWaylandOutputMode preferredMode;
QList<QWaylandOutputMode> modes;
int fd;
- int error;
+ int error = 0 /* means no error according to spec */;
struct {
- uint id;
- uint code;
- const wl_interface *interface;
+ uint id = 0;
+ uint code = 0;
+ const wl_interface *interface = nullptr;
} protocolError;
private slots:
diff --git a/tests/auto/compositor/compositor/testcompositor.cpp b/tests/auto/compositor/compositor/testcompositor.cpp
index f91d0d3f1..710bb7b3a 100644
--- a/tests/auto/compositor/compositor/testcompositor.cpp
+++ b/tests/auto/compositor/compositor/testcompositor.cpp
@@ -33,8 +33,7 @@
#include <wayland-server.h>
TestCompositor::TestCompositor(bool createInputDev)
- : QWaylandCompositor()
- , shell(new QWaylandWlShell(this))
+ : shell(new QWaylandWlShell(this))
, m_createSeat(createInputDev)
{
setSocketName("wayland-qt-test-0");