~ubuntu-branches/ubuntu/vivid/mir/vivid

« back to all changes in this revision

Viewing changes to tests/unit-tests/client/test_client_mir_surface.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-01-08 02:04:38 UTC
  • mto: This revision was merged to the branch mainline in revision 58.
  • Revision ID: package-import@ubuntu.com-20140108020438-e1npu0pm7qdv5wc4
Tags: upstream-0.1.3+14.04.20140108
ImportĀ upstreamĀ versionĀ 0.1.3+14.04.20140108

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
    int height_sent;
127
127
    int pf_sent;
128
128
    int stride_sent;
129
 
    
 
129
 
130
130
    int input_fd;
131
131
 
132
132
    private:
180
180
    MOCK_METHOD0(secure_for_cpu_write, std::shared_ptr<mcl::MemoryRegion>());
181
181
    MOCK_CONST_METHOD0(size, geom::Size());
182
182
    MOCK_CONST_METHOD0(stride, geom::Stride());
183
 
    MOCK_CONST_METHOD0(pixel_format, geom::PixelFormat());
 
183
    MOCK_CONST_METHOD0(pixel_format, MirPixelFormat());
184
184
    MOCK_CONST_METHOD0(age, uint32_t());
185
185
    MOCK_METHOD0(increment_age, void());
186
186
    MOCK_METHOD0(mark_as_submitted, void());
203
203
 
204
204
    MOCK_METHOD3(create_buffer,
205
205
                 std::shared_ptr<mcl::ClientBuffer>(std::shared_ptr<MirBufferPackage> const&,
206
 
                                                    geom::Size, geom::PixelFormat));
 
206
                                                    geom::Size, MirPixelFormat));
207
207
 
208
208
    std::shared_ptr<MirBufferPackage> current_package;
209
209
    std::shared_ptr<mcl::ClientBuffer> current_buffer;
214
214
{
215
215
    MirPlatformType platform_type() const
216
216
    {
217
 
        return mir_platform_type_android; 
218
 
    } 
 
217
        return mir_platform_type_android;
 
218
    }
219
219
    std::shared_ptr<mcl::ClientBufferFactory> create_buffer_factory()
220
220
    {
221
221
        return std::shared_ptr<MockClientBufferFactory>();
310
310
 
311
311
        test_server->comm->start();
312
312
 
313
 
        mock_buffer_factory = std::make_shared<mt::MockClientBufferFactory>();
 
313
        mock_buffer_factory = std::make_shared<testing::NiceMock<mt::MockClientBufferFactory>>();
314
314
 
315
315
        input_platform = std::make_shared<mt::StubClientInputPlatform>();
316
316
 
469
469
{
470
470
    using namespace testing;
471
471
 
472
 
    geom::PixelFormat pf;
 
472
    MirPixelFormat pf;
473
473
    std::shared_ptr<MirBufferPackage> submitted_package;
474
474
 
475
475
    EXPECT_CALL(*mock_buffer_factory, create_buffer(_,_,_))
482
482
    auto wait_handle = surface->get_create_wait_handle();
483
483
    wait_handle->wait_for_all();
484
484
 
485
 
    EXPECT_EQ(pf, geom::PixelFormat::abgr_8888);
 
485
    EXPECT_EQ(pf, mir_pixel_format_abgr_8888);
486
486
}
487
487
 
488
488
 
497
497
TEST_F(MirClientSurfaceTest, input_fd_used_to_create_input_thread_when_delegate_specified)
498
498
{
499
499
    using namespace ::testing;
500
 
    
 
500
 
501
501
    auto mock_input_platform = std::make_shared<mt::MockClientInputPlatform>();
502
502
    auto mock_input_thread = std::make_shared<NiceMock<mt::MockInputReceiverThread>>();
503
503
    MirEventDelegate delegate = {null_event_callback, nullptr};
637
637
 
638
638
struct StubBuffer : public mcl::ClientBuffer
639
639
{
640
 
    StubBuffer(geom::Size size, geom::Stride stride, geom::PixelFormat pf)
 
640
    StubBuffer(geom::Size size, geom::Stride stride, MirPixelFormat pf)
641
641
        : size_{size}, stride_{stride}, pf_{pf}
642
642
    {
643
643
    }
655
655
 
656
656
    geom::Size size() const { return size_; }
657
657
    geom::Stride stride() const { return stride_; }
658
 
    geom::PixelFormat pixel_format() const { return pf_; }
 
658
    MirPixelFormat pixel_format() const { return pf_; }
659
659
    uint32_t age() const { return 0; }
660
660
    void increment_age() {}
661
661
    void mark_as_submitted() {}
667
667
 
668
668
    geom::Size size_;
669
669
    geom::Stride stride_;
670
 
    geom::PixelFormat pf_;
 
670
    MirPixelFormat pf_;
671
671
};
672
672
 
673
673
struct StubClientBufferFactory : public mcl::ClientBufferFactory
674
674
{
675
675
    std::shared_ptr<mcl::ClientBuffer> create_buffer(
676
676
        std::shared_ptr<MirBufferPackage> const& package,
677
 
        geom::Size size, geom::PixelFormat pf)
 
677
        geom::Size size, MirPixelFormat pf)
678
678
    {
679
679
        return std::make_shared<StubBuffer>(size,
680
680
                                            geom::Stride{package->stride},