2
* Copyright © 2014 Canonical Ltd.
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.
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.h"
21
#include "mir_test_framework/stubbed_server_configuration.h"
22
#include "mir_test_framework/basic_client_server_fixture.h"
23
//#include "mir_test_doubles/null_display_buffer_compositor_factory.h"
24
#include "mir_test/signal.h"
26
#include <gtest/gtest.h>
28
namespace mtf = mir_test_framework;
29
namespace mt = mir::test;
30
//namespace mtd = mir::test::doubles;
31
namespace mc = mir::compositor;
36
//struct StubServerConfig : mtf::StubbedServerConfiguration
38
// auto the_display_buffer_compositor_factory()
39
// -> std::shared_ptr<mc::DisplayBufferCompositorFactory> override
41
// return std::make_shared<mtd::NullDisplayBufferCompositorFactory>();
45
//void swap_buffers_callback(MirSurface*, void* ctx)
47
// auto buffers_swapped = static_cast<mt::Signal*>(ctx);
48
// buffers_swapped->raise();
51
//using MirSurfaceSwapBuffersTest = mtf::BasicClientServerFixture<StubServerConfig>;
55
//TEST_F(MirSurfaceSwapBuffersTest, swap_buffers_does_not_block_when_surface_is_not_composited)
57
// using namespace testing;
59
// MirSurfaceParameters request_params =
61
// __PRETTY_FUNCTION__,
63
// mir_pixel_format_abgr_8888,
64
// mir_buffer_usage_hardware,
65
// mir_display_output_id_invalid
68
// auto const surface = mir_connection_create_surface_sync(connection, &request_params);
69
// ASSERT_TRUE(mir_surface_is_valid(surface));
71
// for (int i = 0; i < 10; ++i)
73
// mt::Signal buffers_swapped;
75
// mir_surface_swap_buffers(surface, swap_buffers_callback, &buffers_swapped);
78
// * ASSERT instead of EXPECT, since if we continue we will block in future
79
// * mir client calls (e.g mir_connection_release).
81
// ASSERT_TRUE(buffers_swapped.wait_for(std::chrono::seconds{5}));
84
// mir_surface_release_sync(surface);