• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 */
15
16jest.mock('../../../../dist/trace/component/trace/base/TraceRow.js', () => {
17  return {};
18});
19
20// @ts-ignore
21import { IrqRender, IrqStruct } from '../../../../dist/trace/database/ui-worker/ProcedureWorkerIrq.js';
22
23describe('ProcedureWorkerIrq Test', () => {
24  it('ProcedureWorkerIrq01', () => {
25    const canvas = document.createElement('canvas');
26    canvas.width = 4;
27    canvas.height = 4;
28    const ctx = canvas.getContext('2d');
29
30    const data = {
31      frame: {
32        x: 210,
33        y: 210,
34        width: 100,
35        height: 100,
36      },
37      id: 155,
38      startNS: 1745,
39      name: '4515',
40      dur: 4555,
41      argSetId: 10,
42    };
43    expect(IrqStruct.draw(ctx!, data, true)).toBeUndefined();
44  });
45
46  it('ProcedureWorkerIrq02', () => {
47    const canvas = document.createElement('canvas');
48    canvas.width = 1;
49    canvas.height = 1;
50    const ctx = canvas.getContext('2d');
51    let data = { textMetricsWidth: 1 };
52    expect(
53      IrqStruct.draw(
54        ctx,
55        '253',
56        2,
57        {
58          x: 20,
59          y: 20,
60          width: 100,
61          height: 100,
62        },
63        data
64      )
65    ).toBeUndefined();
66  });
67});
68