on xenial help sign in
fix MirSurface resizing in mock app manager
55618c3Michael Zanetti
tests/mocks/Unity/Application/MirSurface.cpp+7
@@ -170,13 +170,20 @@ int MirSurface::height() const
170
170
171void MirSurface::resize(int width, int height)
171void MirSurface::resize(int width, int height)
172{
172{
173+ bool changed = false;
173 if (width != m_width) {
174 if (width != m_width) {
174 m_width = width;
175 m_width = width;
175 Q_EMIT widthChanged();
176 Q_EMIT widthChanged();
177+ changed = true;
176 }
178 }
177
179
178 if (m_height != height) {
180 if (m_height != height) {
179 m_height = height;
181 m_height = height;
180 Q_EMIT heightChanged();
182 Q_EMIT heightChanged();
183+ changed = true;
184+ }
185+
186+ if (changed) {
187+ Q_EMIT sizeChanged(QSize(width, height));
181 }
188 }
182}
189}
tests/mocks/Unity/Application/MirSurfaceItem.cpp+2−2
@@ -254,7 +254,7 @@ int MirSurfaceItem::surfaceWidth() const
254
254
255void MirSurfaceItem::setSurfaceWidth(int value)
255void MirSurfaceItem::setSurfaceWidth(int value)
256{
256{
257− if (m_surfaceWidth != value) {
257+ if (value != -1 && m_surfaceWidth != value) {
258 m_surfaceWidth = value;
258 m_surfaceWidth = value;
259 Q_EMIT surfaceWidthChanged(m_surfaceWidth);
259 Q_EMIT surfaceWidthChanged(m_surfaceWidth);
260 updateSurfaceSize();
260 updateSurfaceSize();
@@ -268,7 +268,7 @@ int MirSurfaceItem::surfaceHeight() const
268
268
269void MirSurfaceItem::setSurfaceHeight(int value)
269void MirSurfaceItem::setSurfaceHeight(int value)
270{
270{
271− if (m_surfaceHeight != value) {
271+ if (value != -1 && m_surfaceHeight != value) {
272 m_surfaceHeight = value;
272 m_surfaceHeight = value;
273 Q_EMIT surfaceHeightChanged(m_surfaceHeight);
273 Q_EMIT surfaceHeightChanged(m_surfaceHeight);
274 updateSurfaceSize();
274 updateSurfaceSize();