on xenial help sign in
Fix tst_SurfaceContainer
commited94a000544d1c6ff352417d049fc3497f3239fe authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateThu 7 Apr 2016, 10:54 (11 years ago) parentbd42e4d
2 files changed+19−5
tests/mocks/Unity/Application/ApplicationInfo.h+2 tests/qmltests/Stages/tst_SurfaceContainer.qml+17−5
tests/mocks/Unity/Application/ApplicationInfo.h+2
@@ -44,6 +44,8 @@ class ApplicationInfo : public ApplicationInfoInterface {
4444 // whether the test code will explicitly control the creation of the application surface
4545 Q_PROPERTY(bool manualSurfaceCreation READ manualSurfaceCreation WRITE setManualSurfaceCreation NOTIFY manualSurfaceCreationChanged)
4646
47+ Q_PROPERTY(QString screenshot READ screenshot CONSTANT)
48+
4749public:
4850 ApplicationInfo(QObject *parent = nullptr);
4951 ApplicationInfo(const QString &appId, QObject *parent = nullptr);
tests/qmltests/Stages/tst_SurfaceContainer.qml+17−5
@@ -39,10 +39,12 @@ Rectangle {
3939 id: surfaceContainerComponent
4040
4141 SurfaceContainer {
42− id: surfaceContainer
4342 anchors.fill: parent
4443 focus: true
4544 interactive: interactiveCheckbox.checked
45+ Component.onDestruction: {
46+ surfaceContainerLoader.itemDestroyed = true;
47+ }
4648 }
4749 }
4850
@@ -56,6 +58,7 @@ Rectangle {
5658 left: parent.left
5759 }
5860 width: units.gu(40)
61+ property bool itemDestroyed: false
5962 sourceComponent: surfaceContainerComponent
6063 }
6164
@@ -102,7 +105,7 @@ Rectangle {
102105 application.setState(ApplicationInfoInterface.Starting);
103106
104107 surfaceContainerLoader.item.surface = SurfaceManager.createSurface("foo",
105− Mir.NormalType, Mir.MaximizedState, application);
108+ Mir.NormalType, Mir.MaximizedState, application.screenshot);
106109
107110 application.setState(ApplicationInfoInterface.Running);
108111 } else {
@@ -143,18 +146,27 @@ Rectangle {
143146
144147 UT.UnityTestCase {
145148 id: testCase
146− name: "SessionContainer"
149+ name: "SurfaceContainer"
147150
148151 property Item surfaceContainer: surfaceContainerLoader.status === Loader.Ready ? surfaceContainerLoader.item : null
149152
150153 function cleanup() {
151154 // reload our test subject to get it in a fresh state once again
155+
156+ surfaceContainerLoader.itemDestroyed = false;
152157 surfaceContainerLoader.active = false;
158+
159+ tryCompare(surfaceContainerLoader, "status", Loader.Null);
160+ tryCompare(surfaceContainerLoader, "item", null);
161+ tryCompare(surfaceContainerLoader, "itemDestroyed", true);
162+
163+ killApps();
164+
153165 surfaceCheckbox.checked = false;
154166 interactiveCheckbox.checked = true;
155− surfaceContainerLoader.active = true;
156167
157− tryCompare(surfaceContainerLoader.item, "surface", null);
168+ surfaceContainerLoader.active = true;
169+ tryCompare(surfaceContainerLoader, "status", Loader.Ready);
158170 }
159171
160172 when: windowShown