~lukas-kde/miral/shellchrome-windowinfo

« back to all changes in this revision

Viewing changes to miral-qt/tests/framework/fake_session.h

  • Committer: Larry Price
  • Date: 2016-09-13 16:19:29 UTC
  • mto: (330.4.1 miral)
  • mto: This revision was merged to the branch mainline in revision 352.
  • Revision ID: larry.price@canonical.com-20160913161929-vs9ka1capmljq1es
Removing miral-qt from release branch, updating copyright file, and adding GPL3 license to root dir

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2015-2016 Canonical, Ltd.
3
 
 *
4
 
 * This program is free software: you can redistribute it and/or modify it under
5
 
 * the terms of the GNU Lesser General Public License version 3, as published by
6
 
 * the Free Software Foundation.
7
 
 *
8
 
 * This program is distributed in the hope that it will be useful, but WITHOUT
9
 
 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10
 
 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11
 
 * Lesser General Public License for more details.
12
 
 *
13
 
 * You should have received a copy of the GNU Lesser General Public License
14
 
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
 
 */
16
 
 
17
 
#include <Unity/Application/session_interface.h>
18
 
#include <Unity/Application/sessionmodel.h>
19
 
#include <Unity/Application/mirsurfacelistmodel.h>
20
 
#include <QDebug>
21
 
 
22
 
#ifndef QTMIR_FAKE_SESSION_H
23
 
#define QTMIR_FAKE_SESSION_H
24
 
 
25
 
namespace qtmir {
26
 
 
27
 
class FakeSession : public SessionInterface
28
 
{
29
 
    Q_OBJECT
30
 
 
31
 
public:
32
 
    FakeSession();
33
 
    virtual ~FakeSession();
34
 
 
35
 
    QString name() const override;
36
 
    unity::shell::application::ApplicationInfoInterface* application() const override;
37
 
    MirSurfaceListModel* surfaceList() override;
38
 
    MirSurfaceListModel* promptSurfaceList() override;
39
 
    SessionModel* childSessions() const override;
40
 
    State state() const override;
41
 
    bool fullscreen() const override;
42
 
    bool live() const override;
43
 
 
44
 
    std::shared_ptr<mir::scene::Session> session() const override;
45
 
 
46
 
    // For MirSurfaceItem and MirSurfaceManager use
47
 
 
48
 
    void registerSurface(MirSurfaceInterface*) override;
49
 
 
50
 
    // For Application use
51
 
 
52
 
    void setApplication(unity::shell::application::ApplicationInfoInterface* app) override;
53
 
    void suspend() override;
54
 
    void resume() override;
55
 
    void stop() override;
56
 
    bool hadSurface() const override;
57
 
    bool hasClosingSurfaces() const override;
58
 
 
59
 
    void close() override;
60
 
 
61
 
    bool activeFocus() const override { return false; }
62
 
 
63
 
    pid_t pid() const override { return 0; }
64
 
 
65
 
    // For SessionManager use
66
 
 
67
 
    void addChildSession(SessionInterface*) override;
68
 
    void insertChildSession(uint, SessionInterface*) override;
69
 
    void removeChildSession(SessionInterface*) override;
70
 
    void foreachChildSession(const std::function<void(SessionInterface* session)> &) const override;
71
 
 
72
 
    std::shared_ptr<mir::scene::PromptSession> activePromptSession() const override;
73
 
    void foreachPromptSession(const std::function<void(const std::shared_ptr<mir::scene::PromptSession>&)> &) const override;
74
 
 
75
 
    void setFullscreen(bool) override;
76
 
    void setLive(const bool) override;
77
 
    void appendPromptSession(const std::shared_ptr<mir::scene::PromptSession>&) override;
78
 
    void removePromptSession(const std::shared_ptr<mir::scene::PromptSession>&) override;
79
 
 
80
 
    // For tests
81
 
 
82
 
    void setState(State state);
83
 
    void setSession(std::shared_ptr<mir::scene::Session> session);
84
 
 
85
 
private:
86
 
    unity::shell::application::ApplicationInfoInterface* m_application;
87
 
    State m_state;
88
 
    std::shared_ptr<mir::scene::Session> m_session;
89
 
    MirSurfaceListModel m_surfaceList;
90
 
    MirSurfaceListModel m_promptSurfaceList;
91
 
    SessionModel *m_childSessions{new SessionModel};
92
 
};
93
 
 
94
 
} // namespace qtmi
95
 
 
96
 
#endif // QTMIR_FAKE_SESSION_H