~afrantzis/mir/fix-mircommon-debian-replaces

« back to all changes in this revision

Viewing changes to tests/acceptance-tests/test_server_without_active_outputs.cpp

  • Committer: Tarmac
  • Author(s): Alexandros Frantzis
  • Date: 2014-07-30 13:39:12 UTC
  • mfrom: (1798.3.2 fix-1344024)
  • Revision ID: tarmac-20140730133912-bgi83tv22dzos82x
server: Allow clients to create surfaces even when there are no active outputs (LP: #1344024)

This is fixed by removing obsolete placement rules from our default placement
policy. These rules had the side-effect of prohibiting surface creation when
there were no active outputs. Fixes: https://bugs.launchpad.net/bugs/1344024.

Approved by Alan Griffiths, PS Jenkins bot.

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: Alexandros Frantzis <alexandros.frantzis@canonical.com>
 
17
 */
 
18
 
 
19
#include "mir_toolkit/mir_client_library.h"
 
20
 
 
21
#include "mir_test_framework/stubbed_server_configuration.h"
 
22
#include "mir_test_framework/basic_client_server_fixture.h"
 
23
 
 
24
#include <gtest/gtest.h>
 
25
#include <gmock/gmock.h>
 
26
 
 
27
namespace mtf = mir_test_framework;
 
28
namespace geom = mir::geometry;
 
29
 
 
30
namespace
 
31
{
 
32
 
 
33
struct NoOutputsServerConfig : mtf::StubbedServerConfiguration
 
34
{
 
35
    NoOutputsServerConfig()
 
36
        : mtf::StubbedServerConfiguration(std::vector<geom::Rectangle>{})
 
37
    {
 
38
    }
 
39
};
 
40
 
 
41
using ServerWithoutActiveOutputs = mtf::BasicClientServerFixture<NoOutputsServerConfig>;
 
42
 
 
43
}
 
44
 
 
45
TEST_F(ServerWithoutActiveOutputs, creates_valid_client_surface)
 
46
{
 
47
    using namespace testing;
 
48
 
 
49
    MirSurfaceParameters const request_params =
 
50
    {
 
51
        __PRETTY_FUNCTION__,
 
52
        640, 480,
 
53
        mir_pixel_format_abgr_8888,
 
54
        mir_buffer_usage_hardware,
 
55
        mir_display_output_id_invalid
 
56
    };
 
57
 
 
58
    auto const surface = mir_connection_create_surface_sync(connection, &request_params);
 
59
 
 
60
    EXPECT_THAT(mir_surface_is_valid(surface), Eq(mir_true))
 
61
        << mir_surface_get_error_message(surface);
 
62
 
 
63
    mir_surface_release_sync(surface);
 
64
}