1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 tvcm.require('cc.picture_ops_list_view');
8 tvcm.require('cc.picture');
9 tvcm.require('tracing.importer.trace_event_importer');
10 tvcm.require('tracing.trace_model');
11 tvcm.requireRawScript('cc/layer_tree_host_impl_test_data.js');
13 tvcm.unittest.testSuite('cc.picture_ops_list_view_test', function() {
14 var PictureOpsListView = cc.PictureOpsListView;
16 test('instantiate', function() {
17 if (!cc.PictureSnapshot.CanRasterize())
19 var m = new tracing.TraceModel(g_catLTHIEvents);
20 var p = tvcm.dictionaryValues(m.processes)[0];
22 var instance = p.objects.getAllInstancesNamed('cc::Picture')[0];
23 var snapshot = instance.snapshots[0];
25 var view = new PictureOpsListView();
26 view.picture = snapshot;
27 assertEquals(627, view.opsList_.children.length);
30 test('selection', function() {
31 if (!cc.PictureSnapshot.CanRasterize())
33 var m = new tracing.TraceModel(g_catLTHIEvents);
34 var p = tvcm.dictionaryValues(m.processes)[0];
36 var instance = p.objects.getAllInstancesNamed('cc::Picture')[0];
37 var snapshot = instance.snapshots[0];
39 var view = new PictureOpsListView();
40 view.picture = snapshot;
41 var didSelectionChange = 0;
42 view.addEventListener('selection-changed', function() {
43 didSelectionChange = true;
45 assertFalse(didSelectionChange);
46 view.opsList_.selectedElement = view.opsList_.children[3];
47 assertTrue(didSelectionChange);