2
* Copyright © 2013-2014 Canonical Ltd.
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.
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.
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/>.
16
* Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
19
#include "mir_toolkit/mir_client_library_drm.h"
21
#include "mir_test_framework/connected_client_headless_server.h"
23
#include <gtest/gtest.h>
24
#include <gmock/gmock.h>
26
namespace mtf = mir_test_framework;
27
using namespace testing;
29
using MirClientLibraryDrmTest = mtf::ConnectedClientHeadlessServer;
31
TEST_F(MirClientLibraryDrmTest, sets_gbm_device_in_platform_data)
33
struct gbm_device* dev = reinterpret_cast<struct gbm_device*>(connection);
35
MirPlatformPackage pkg;
37
mir_connection_get_platform(connection, &pkg);
38
int const previous_data_count{pkg.data_items};
40
mir_connection_drm_set_gbm_device(connection, dev);
41
mir_connection_get_platform(connection, &pkg);
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]),