• 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
16// @ts-ignore
17import { CpuFreqStruct } from '../../../dist/trace/bean/CpuFreqStruct.js';
18
19describe('CpuFreqStruct Test', () => {
20  const canvas = document.createElement('canvas');
21  canvas.width = 1;
22  canvas.height = 1;
23  const ctx = canvas.getContext('2d');
24
25  CpuFreqStruct.hoverCpuFreqStruct = void 0;
26  const data = {
27    frame: {
28      x: 244,
29      y: 466,
30      width: 34,
31      height: 600,
32    },
33    startNS: 400,
34    value: 43,
35  };
36
37  const dataSource = {
38    frame: {
39      x: 35,
40      y: 66,
41      width: 560,
42      height: 600,
43    },
44    value: 60,
45    maxFreq: 88,
46  };
47
48  it('CpuFreqStructTest01', function () {
49    expect(CpuFreqStruct.draw(ctx, data)).toBeUndefined();
50    expect(data).toMatchInlineSnapshot(`
51{
52  "frame": {
53    "height": 600,
54    "width": 34,
55    "x": 244,
56    "y": 466,
57  },
58  "startNS": 400,
59  "value": 43,
60}
61`);
62  });
63
64  it('CpuFreqStructTest02', function () {
65    expect(CpuFreqStruct.draw(ctx, { startNS: 1 })).toBeUndefined();
66  });
67
68  it('CpuFreqStructTest03 ', function () {
69    expect(CpuFreqStruct.draw(ctx, dataSource)).toBeUndefined();
70  });
71});
72