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

« back to all changes in this revision

Viewing changes to tests/unit-tests/compositor/test_switching_bundle.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-02-04 14:49:07 UTC
  • mto: This revision was merged to the branch mainline in revision 61.
  • Revision ID: package-import@ubuntu.com-20140204144907-o3ruhix0ey26lchl
Tags: upstream-0.1.4+14.04.20140204
ImportĀ upstreamĀ versionĀ 0.1.4+14.04.20140204

Show diffs side-by-side

added added

removed removed

Lines of Context:
329
329
    }
330
330
}
331
331
 
 
332
/*
 
333
 Regression test for LP#1270964
 
334
 In the original bug, SwitchingBundle::last_consumed would be used without ever being set
 
335
 in the compositor_acquire() call, thus its initial value of zero would wrongly be used
 
336
 and lead to the wrong buffer being given to the compositor
 
337
 */
 
338
TEST_F(SwitchingBundleTest, compositor_client_interleaved)
 
339
{
 
340
    int nbuffers = 3;
 
341
    mc::SwitchingBundle bundle(nbuffers, allocator, basic_properties);
 
342
    mg::Buffer* client_buffer = nullptr;
 
343
    std::shared_ptr<mg::Buffer> compositor_buffer = nullptr;
 
344
 
 
345
    client_buffer = bundle.client_acquire();
 
346
    mg::BufferID first_ready_buffer_id = client_buffer->id();
 
347
    bundle.client_release(client_buffer);
 
348
 
 
349
    client_buffer = bundle.client_acquire();
 
350
 
 
351
    // in the original bug, compositor would be given the wrong buffer here
 
352
    compositor_buffer = bundle.compositor_acquire(0 /*frameno*/);
 
353
 
 
354
    ASSERT_EQ(first_ready_buffer_id, compositor_buffer->id());
 
355
 
 
356
    // Clean up
 
357
    bundle.client_release(client_buffer);
 
358
    bundle.compositor_release(compositor_buffer);
 
359
    compositor_buffer.reset();
 
360
}
 
361
 
332
362
TEST_F(SwitchingBundleTest, overlapping_compositors_get_different_frames)
333
363
{
334
364
    // This test simulates bypass behaviour
868
898
        }
869
899
    }
870
900
}
871