• 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: 20,
29            y: 20,
30            width: 100,
31            height: 100
32        },
33        startNS: 200,
34        value: 50
35    }
36
37    const dataSource = {
38        frame: {
39            x: 20,
40            y: 20,
41            width: 100,
42            height: 100
43        },
44        value: 50,
45        maxFreq: 50
46    }
47
48    it('CpuFreqStructTest01', function () {
49        expect(CpuFreqStruct.draw(ctx, data)).toBeUndefined()
50        expect(data).toMatchInlineSnapshot({
51  startNS: expect.any(Number),
52  value: expect.any(Number) }, `
53Object {
54  "frame": Object {
55    "height": 100,
56    "width": 100,
57    "x": 20,
58    "y": 20,
59  },
60  "startNS": Any<Number>,
61  "value": Any<Number>,
62}
63`);
64    });
65
66    it('CpuFreqStructTest02', function () {
67        expect(CpuFreqStruct.draw(ctx, {startNS:1})).toBeUndefined()
68    });
69
70    it('CpuFreqStructTest03 ', function () {
71        expect(CpuFreqStruct.draw(ctx,dataSource)).toBeUndefined()
72
73    });
74})
75