~vanvugt/mir/revert-r2288

« back to all changes in this revision

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

client: Add set_gbm_device platform operation.

Approved by PS Jenkins bot, Robert Carr, Alan Griffiths.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright © 2013-2014 Canonical Ltd.
3
 
 *
4
 
 * This program is free software: you can redistribute it and/or modify
5
 
 * it under the terms of the GNU General Public License version 3 as
6
 
 * 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_drm.h"
20
 
 
21
 
#include "mir_test_framework/connected_client_headless_server.h"
22
 
 
23
 
#include <gtest/gtest.h>
24
 
#include <gmock/gmock.h>
25
 
 
26
 
namespace mtf = mir_test_framework;
27
 
using namespace testing;
28
 
 
29
 
using MirClientLibraryDrmTest = mtf::ConnectedClientHeadlessServer;
30
 
 
31
 
TEST_F(MirClientLibraryDrmTest, sets_gbm_device_in_platform_data)
32
 
{
33
 
    struct gbm_device* dev = reinterpret_cast<struct gbm_device*>(connection);
34
 
 
35
 
    MirPlatformPackage pkg;
36
 
 
37
 
    mir_connection_get_platform(connection, &pkg);
38
 
    int const previous_data_count{pkg.data_items};
39
 
 
40
 
    mir_connection_drm_set_gbm_device(connection, dev);
41
 
    mir_connection_get_platform(connection, &pkg);
42
 
 
43
 
    EXPECT_THAT(pkg.data_items, Eq(previous_data_count + (sizeof(dev) / sizeof(int))));
44
 
    EXPECT_THAT(reinterpret_cast<struct gbm_device*>(pkg.data[previous_data_count]),
45
 
                Eq(dev));
46
 
}