~ubuntu-branches/ubuntu/utopic/mir/utopic-proposed

« back to all changes in this revision

Viewing changes to tests/unit-tests/graphics/android/test_hwc_common_device.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-03-10 19:28:46 UTC
  • mto: This revision was merged to the branch mainline in revision 63.
  • Revision ID: package-import@ubuntu.com-20140310192846-rq9qm3ec26yrelo2
Tags: upstream-0.1.6+14.04.20140310
ImportĀ upstreamĀ versionĀ 0.1.6+14.04.20140310

Show diffs side-by-side

added added

removed removed

Lines of Context:
163
163
    }, std::runtime_error);
164
164
}
165
165
 
166
 
TYPED_TEST(HWCCommon, test_hwc_suspend_standby_turn_off)
 
166
TYPED_TEST(HWCCommon, test_hwc_suspend_standby_throw)
167
167
{
168
168
    using namespace testing;
169
 
 
170
 
    EXPECT_CALL(*this->mock_device, blank_interface(this->mock_device.get(), HWC_DISPLAY_PRIMARY, 0))
171
 
        .Times(3)
172
 
        .WillRepeatedly(Return(0));
173
 
    EXPECT_CALL(*this->mock_device, blank_interface(this->mock_device.get(), HWC_DISPLAY_PRIMARY, 1))
174
 
        .Times(3)
175
 
        .WillRepeatedly(Return(0));
176
 
 
177
169
    auto device = make_hwc_device<TypeParam>(this->mock_device, this->mock_fbdev, this->mock_vsync);
178
 
    device->mode(mir_power_mode_off);
179
 
    device->mode(mir_power_mode_on);
180
 
    device->mode(mir_power_mode_suspend);
181
 
    device->mode(mir_power_mode_on);
182
 
    device->mode(mir_power_mode_standby);
 
170
 
 
171
    EXPECT_THROW({
 
172
        device->mode(mir_power_mode_suspend);
 
173
    }, std::runtime_error);
 
174
    EXPECT_THROW({
 
175
        device->mode(mir_power_mode_standby);
 
176
    }, std::runtime_error);
183
177
}
184
178
 
185
179
TYPED_TEST(HWCCommon, test_hwc_deactivates_vsync_on_blank)
203
197
    device->mode(mir_power_mode_off);
204
198
}
205
199
 
206
 
TYPED_TEST(HWCCommon, test_blank_is_ignored_if_already_in_correct_state)
207
 
{
208
 
    using namespace testing;
209
 
 
210
 
    //we start off unblanked
211
 
 
212
 
    InSequence seq;
213
 
    //from constructor
214
 
    EXPECT_CALL(*this->mock_device, blank_interface(this->mock_device.get(), HWC_DISPLAY_PRIMARY, 0))
215
 
        .Times(Exactly(1))
216
 
        .WillOnce(Return(0));
217
 
     //from destructor
218
 
    EXPECT_CALL(*this->mock_device, blank_interface(this->mock_device.get(), HWC_DISPLAY_PRIMARY, 1))
219
 
        .Times(1)
220
 
        .WillOnce(Return(0));
221
 
 
222
 
    auto device = make_hwc_device<TypeParam>(this->mock_device, this->mock_fbdev, this->mock_vsync);
223
 
    device->mode(mir_power_mode_on);
224
 
}
225
 
 
226
200
TYPED_TEST(HWCCommon, test_hwc_display_is_deactivated_on_destroy)
227
201
{
228
202
    auto device = make_hwc_device<TypeParam>(this->mock_device, this->mock_fbdev, this->mock_vsync);
249
223
        .Times(1);
250
224
    procs->vsync(procs, 0, 0);
251
225
}
 
226
 
 
227
TYPED_TEST(HWCCommon, set_orientation)
 
228
{
 
229
    auto device = make_hwc_device<TypeParam>(this->mock_device, this->mock_fbdev, this->mock_vsync);
 
230
    EXPECT_FALSE(device->apply_orientation(mir_orientation_left));
 
231
}