• 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 {proc, ProcessStruct} from "../../../dist/trace/database/ProcedureWorkerProcess.js";
18// @ts-ignore
19import {Rect} from "../../../dist/trace/component/trace/timer-shaft/Rect.js";
20
21describe(' ProcessTest', () => {
22
23    it('ProcessTest01', () => {
24        let dataList = new Array();
25        dataList.push({startTime: 0, dur: 10, frame: {x:0, y:9, width:10, height:10}})
26        dataList.push({startTime: 1, dur: 111})
27        let rect = new Rect(0, 10, 10, 10);
28        proc(dataList, new Set(), 1, 100254, 100254, rect)
29    })
30
31    it('ProcessTest02', () => {
32        let dataList = new Array();
33        dataList.push({startTime: 0, dur: 10, frame: {x:0, y:9, width:10, height:10}})
34        dataList.push({startTime: 1, dur: 111, frame: {x:0, y:9, width:10, height:10}})
35        let rect = new Rect(0, 10, 10, 10);
36        proc(dataList, new Set(), 1, 100254, 100254, rect)
37    })
38
39    it('ProcessTest04', () => {
40        const node = {
41            frame: {
42                x: 20,
43                y: 20,
44                width: 100,
45                height: 100
46            },
47            startNS: 200,
48            value: 50
49        }
50        const frame = {
51            x: 20,
52            y: 20,
53            width: 100,
54            height: 100
55        }
56        expect(ProcessStruct.setFrame(node, 1,1,1,frame)).toBeUndefined()
57    })
58});