1/*
2 * Copyright (C) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15import { HiSysEventStruct } from '../../../../src/trace/database/ui-worker/ProcedureWorkerHiSysEvent';
16jest.mock('../../../../src/trace/database/ui-worker/cpu/ProcedureWorkerCPU', () => {
17  return {};
18});
19jest.mock('../../../../src/trace/component/SpSystemTrace', () => {
20  return {};
21});
22describe('ProcedureWorkerHiSysEvent Test',()=>{
23  it('ProcedureWorkerHiSysEventTest01 ', function () {
24    const canvas = document.createElement('canvas');
25    canvas.width = 2;
26    canvas.height = 2;
27    const ctx = canvas.getContext('2d');
28    const data = {
29      frame: {
30        x: 120,
31        y: 120,
32        width: 100,
33        height: 100,
34      },
35      id: 21,
36      ts: 254151,
37      dur: 1201,
38      name: '1583',
39      depth: 6,
40      jank_tag: true,
41      cmdline: 'render.test',
42      type: '0',
43      pid: 21,
44      frame_type: 'render_service',
45      src_slice: '5',
46      rs_ts: 3,
47      rs_vsync: '2561',
48      rs_dur: 965,
49      rs_pid: 320,
50      rs_name: 'name',
51      gpu_dur: 102,
52    };
53    expect(HiSysEventStruct.draw(ctx,data)).toBeUndefined()
54  });
55  it('ProcedureWorkerHiSysEventTest02 ', function () {
56    let node = {
57      frame: {
58        x: 65,
59        y: 20,
60        width: 99,
61        height: 330,
62      },
63      startNS: 200,
64      length: 1,
65      height: 90,
66      startTime: 0,
67      dur: 31,
68    };
69    let frame= {
70      x: 65,
71      y: 20,
72      width: 99,
73      height: 330,
74    }
75    expect(HiSysEventStruct.setSysEventFrame(node,1,2,3,frame)).toBeUndefined()
76  });
77})