~mir-team/mir/development-branch

« back to all changes in this revision

Viewing changes to tests/include/mir_test_doubles/mock_coordinate_translator.h

  • Committer: Tarmac
  • Author(s): Christopher James Halse Rogers
  • Date: 2014-10-27 22:31:16 UTC
  • mfrom: (1840.3.30 bug-bug-debug-the-bugs)
  • Revision ID: tarmac-20141027223116-h1ggv4pjurucd2d9
Add a debug interface to translate from surface to screen coordinates.

This is the Mir part of the infrastructure for Autopilot to determine the screen location of widgets, for full-stack testing.

This is hidden behind a --debug server option, to make it absolutely clear that applications cannot depend on this functionality outside of a constrained environment.

(See also https://lists.ubuntu.com/archives/mir-devel/2014-August/000848.html)

Fixes: https://bugs.launchpad.net/mir/+bug/1346633. Fixes: https://bugs.launchpad.net/bugs/1346633.

Approved by PS Jenkins bot, Alberto Aguirre, Alan Griffiths, Andreas Pokorny, Alexandros Frantzis.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2014 Canonical Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License version 3,
 
6
 * as published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
 
17
 */
 
18
 
 
19
#ifndef MIR_TEST_DOUBLES_MOCK_COORDINATE_TRANSLATOR_H_
 
20
#define MIR_TEST_DOUBLES_MOCK_COORDINATE_TRANSLATOR_H_
 
21
 
 
22
#include "src/server/frontend/coordinate_translator.h"
 
23
 
 
24
#include <gmock/gmock.h>
 
25
 
 
26
namespace mir
 
27
{
 
28
namespace test
 
29
{
 
30
namespace doubles
 
31
{
 
32
class MockCoordinateTranslator : public mir::frontend::CoordinateTranslator
 
33
{
 
34
    MOCK_METHOD3(surface_to_screen, geometry::Point(std::shared_ptr<frontend::Surface>, uint32_t, uint32_t));
 
35
};
 
36
 
 
37
using StubCoordinateTranslator = testing::NiceMock<MockCoordinateTranslator>;
 
38
}
 
39
}
 
40
}
 
41
 
 
42
#endif /* MIR_TEST_DOUBLES_MOCK_COORDINATE_TRANSLATOR_H_ */