2
* Copyright © 2013 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: Robert Carr <robert.carr@canonical.com>
19
#include "src/client/gbm/mesa_native_display_container.h"
21
#include "mir_toolkit/mir_client_library.h"
22
#include "mir_toolkit/mesa/native_display.h"
24
#include <gtest/gtest.h>
25
#include <gmock/gmock.h>
29
namespace mclg = mir::client::gbm;
34
struct MesaNativeDisplayContainerSetup : public testing::Test
36
MesaNativeDisplayContainerSetup()
37
: container(std::make_shared<mclg::MesaNativeDisplayContainer>()),
42
std::shared_ptr<mclg::MesaNativeDisplayContainer> const container;
43
MirConnection* connection;
48
TEST_F(MesaNativeDisplayContainerSetup, valid_displays_come_from_factory)
50
using namespace ::testing;
52
auto display = container->create(connection);
53
EXPECT_TRUE(container->validate(display));
55
MirEGLNativeDisplayType invalid_native_display;
56
EXPECT_FALSE(container->validate(&invalid_native_display));
59
TEST_F(MesaNativeDisplayContainerSetup, releasing_displays_invalidates_address)
61
using namespace ::testing;
63
auto display = container->create(connection);
64
EXPECT_TRUE(container->validate(display));
65
container->release(display);
66
EXPECT_FALSE(container->validate(display));