~alan-griffiths/mir/knee-jerk-mir_surface_state_automatic

« back to all changes in this revision

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

  • Committer: Kevin DuBois
  • Date: 2012-11-13 01:36:29 UTC
  • mfrom: (245 trunk)
  • mto: This revision was merged to the branch mainline in revision 246.
  • Revision ID: kevin.dubois@canonical.com-20121113013629-q4496w4mp5e33auk
merge in base branch. move the demo clients to a new directory, examples/

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <gtest/gtest.h>
24
24
#include <memory>
25
25
namespace mcl=mir::client;
 
26
namespace mcla=mir::client::android;
26
27
namespace geom=mir::geometry;
27
28
 
28
29
namespace
91
92
    ANativeWindow* anw;
92
93
    int value;
93
94
 
94
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
95
    anw = new mcla::MirNativeWindow(mock_surface.get());
95
96
 
96
97
    ASSERT_NE((int) anw->query, NULL);
97
98
    EXPECT_NO_THROW({
108
109
    ANativeWindow* anw;
109
110
    int value;
110
111
 
111
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
112
    anw = new mcla::MirNativeWindow(mock_surface.get());
112
113
 
113
114
    EXPECT_CALL(*mock_surface, get_parameters())
114
115
        .Times(1);
127
128
    ANativeWindow* anw;
128
129
    int value;
129
130
 
130
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
131
    anw = new mcla::MirNativeWindow(mock_surface.get());
131
132
    EXPECT_CALL(*mock_surface, get_parameters())
132
133
        .Times(1);
133
134
 
148
149
    int transform_hint_zero = 0;
149
150
    int value;
150
151
 
151
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
152
    anw = new mcla::MirNativeWindow(mock_surface.get());
152
153
 
153
154
    auto rc = anw->query(anw, NATIVE_WINDOW_TRANSFORM_HINT ,&value);
154
155
 
164
165
    ANativeWindow* anw;
165
166
    int value;
166
167
 
167
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
168
    anw = new mcla::MirNativeWindow(mock_surface.get());
168
169
 
169
170
    auto rc = anw->query(anw, NATIVE_WINDOW_DEFAULT_WIDTH ,&value);
170
171
 
180
181
    ANativeWindow* anw;
181
182
    int value;
182
183
 
183
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
184
    anw = new mcla::MirNativeWindow(mock_surface.get());
184
185
 
185
186
    auto rc = anw->query(anw, NATIVE_WINDOW_DEFAULT_HEIGHT ,&value);
186
187
 
195
196
{
196
197
    ANativeWindow* anw;
197
198
 
198
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
199
    anw = new mcla::MirNativeWindow(mock_surface.get());
199
200
 
200
201
    ASSERT_NE((int) anw->perform, NULL);
201
202
    EXPECT_NO_THROW({
211
212
    ANativeWindow* anw;
212
213
    int format = 945;
213
214
 
214
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
215
    anw = new mcla::MirNativeWindow(mock_surface.get());
215
216
 
216
217
    anw->perform(anw, NATIVE_WINDOW_SET_BUFFERS_FORMAT , format);
217
218
 
228
229
{
229
230
    ANativeWindow* anw;
230
231
 
231
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
232
    anw = new mcla::MirNativeWindow(mock_surface.get());
232
233
 
233
234
    ASSERT_NE((int) anw->setSwapInterval, NULL);
234
235
    EXPECT_NO_THROW({
244
245
    ANativeWindow* anw;
245
246
    ANativeWindowBuffer* tmp;
246
247
 
247
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
248
    anw = new mcla::MirNativeWindow(mock_surface.get());
248
249
 
249
250
    ASSERT_NE((int) anw->dequeueBuffer, NULL);
250
251
    EXPECT_NO_THROW({
263
264
    EXPECT_CALL(*mock_surface, get_current_buffer())
264
265
        .Times(1)
265
266
        .WillOnce(Return(mock_client_buffer)); 
266
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
267
    anw = new mcla::MirNativeWindow(mock_surface.get());
267
268
 
268
269
    anw->dequeueBuffer(anw, &tmp);
269
270
    
287
288
        .Times(1)
288
289
        .WillOnce(Return(mock_client_buffer));
289
290
 
290
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
291
    anw = new mcla::MirNativeWindow(mock_surface.get());
291
292
 
292
293
    anw->dequeueBuffer(anw, &tmp);
293
294
   
302
303
 
303
304
    ANativeWindowBuffer* tmp;
304
305
 
305
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
306
    anw = new mcla::MirNativeWindow(mock_surface.get());
306
307
 
307
308
    auto ret = anw->dequeueBuffer(anw, &tmp);
308
309
    EXPECT_EQ(ret, 0);
316
317
    ANativeWindow* anw;
317
318
    ANativeWindowBuffer* tmp = 0x0;
318
319
 
319
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
320
    anw = new mcla::MirNativeWindow(mock_surface.get());
320
321
 
321
322
    ASSERT_NE((int) anw->queueBuffer, NULL);
322
323
    EXPECT_NO_THROW({
334
335
 
335
336
    EXPECT_CALL(*mock_surface, next_buffer(_,_))
336
337
        .Times(1);
337
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
338
    anw = new mcla::MirNativeWindow(mock_surface.get());
338
339
 
339
340
    anw->queueBuffer(anw, tmp);
340
341
 
347
348
    ANativeWindow* anw;
348
349
    ANativeWindowBuffer* tmp = 0x0;
349
350
 
350
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
351
    anw = new mcla::MirNativeWindow(mock_surface.get());
351
352
 
352
353
    ASSERT_NE((int) anw->cancelBuffer, NULL);
353
354
    EXPECT_NO_THROW({
363
364
    ANativeWindow* anw;
364
365
    ANativeWindowBuffer* tmp = 0x0;
365
366
 
366
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
367
    anw = new mcla::MirNativeWindow(mock_surface.get());
367
368
 
368
369
    ASSERT_NE((int) anw->lockBuffer, NULL);
369
370
    EXPECT_NO_THROW({
377
378
{
378
379
    ANativeWindow* anw;
379
380
 
380
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
381
    anw = new mcla::MirNativeWindow(mock_surface.get());
381
382
 
382
383
    ASSERT_NE((int) anw->common.incRef, NULL);
383
384
    EXPECT_NO_THROW({
392
393
{
393
394
    ANativeWindow* anw;
394
395
 
395
 
    anw = new mcl::MirNativeWindow(mock_surface.get());
 
396
    anw = new mcla::MirNativeWindow(mock_surface.get());
396
397
 
397
398
    ASSERT_NE((int) anw->common.decRef, NULL);
398
399
    EXPECT_NO_THROW({