~mir-team/mir/trunk

« back to all changes in this revision

Viewing changes to tests/unit-tests/shell/test_organising_surface_factory.cpp

  • Committer: Tarmac
  • Author(s): Alan Griffiths
  • Date: 2013-04-25 23:50:01 UTC
  • mfrom: (526.2.22 mir1)
  • Revision ID: tarmac-20130425235001-c3b3x2yyb3eldyx1
frontend, shell, tests: surface-states updated to avoid supplying dependencies through public member functions.

Approved by PS Jenkins bot, Chris Halse Rogers, Robert Ancell, Kevin DuBois.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <gtest/gtest.h>
26
26
#include <gmock/gmock.h>
27
27
 
 
28
namespace me = mir::events;
28
29
namespace mf = mir::frontend;
29
30
namespace msh = mir::shell;
30
31
namespace geom = mir::geometry;
45
46
        using namespace ::testing;
46
47
 
47
48
        underlying_surface_factory = std::make_shared<mtd::MockSurfaceFactory>();
48
 
        ON_CALL(*underlying_surface_factory, create_surface(_)).WillByDefault(Return(null_surface));
 
49
        ON_CALL(*underlying_surface_factory, create_surface(_, _, _)).WillByDefault(Return(null_surface));
49
50
 
50
51
        placement_strategy = std::make_shared<MockPlacementStrategy>();
51
52
    }
62
63
 
63
64
    msh::OrganisingSurfaceFactory factory(underlying_surface_factory, placement_strategy);
64
65
 
65
 
    EXPECT_CALL(*underlying_surface_factory, create_surface(_)).Times(1);
 
66
    EXPECT_CALL(*underlying_surface_factory, create_surface(_, _, _)).Times(1);
66
67
 
67
68
    auto params = mf::a_surface();
68
69
    EXPECT_CALL(*placement_strategy, place(Ref(params))).Times(1)
69
70
        .WillOnce(Return(mf::a_surface()));
70
71
 
71
 
    factory.create_surface(params);
 
72
    factory.create_surface(params, mf::SurfaceId(), std::shared_ptr<me::EventSink>());
72
73
}
73
74
 
74
75
TEST_F(OrganisingSurfaceFactorySetup, forwards_create_surface_parameters_from_placement_strategy_to_underlying_factory)
83
84
 
84
85
    EXPECT_CALL(*placement_strategy, place(Ref(params))).Times(1)
85
86
        .WillOnce(Return(placed_params));
86
 
    EXPECT_CALL(*underlying_surface_factory, create_surface(placed_params));
 
87
    EXPECT_CALL(*underlying_surface_factory, create_surface(placed_params, mf::SurfaceId(), std::shared_ptr<me::EventSink>()));
87
88
 
88
 
    factory.create_surface(params);
 
89
    factory.create_surface(params, mf::SurfaceId(), std::shared_ptr<me::EventSink>());
89
90
}
90
91