• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 #include "test/unittest/core/pipeline/velocity_tracker_test.h"
17 
18 using namespace testing;
19 using namespace testing::ext;
20 
21 namespace OHOS::Ace::NG {
22 namespace {
23 using EventDataInt = std::vector<std::vector<int32_t>>;
24 using EventDataFloat = std::vector<std::vector<float>>;
25 
26 EventDataInt sampleData1 = {
27     {100, 5479, 16579}, {107, 5479, 16542}, {114, 5479, 16497}, {121, 5476, 16458}
28 };
29 
30 EventDataInt sampleData2 = {
31     {100, 5479, 16579}, {107, 5479, 16542}, {114, 5479, 16497}, {121, 5476, 16458}, {128, 5472, 16403}
32 };
33 
34 EventDataInt sampleData3 = {
35     {100, 5479, 16579}, {107, 5479, 16542}, {114, 5479, 16497}, {121, 5476, 16458}, {128, 5472, 16403},
36     {135, 5470, 16350}
37 };
38 
39 EventDataInt sampleData4 = {
40     {100, 5479, 16579}, {107, 5479, 16542}, {114, 5479, 16497}, {121, 5476, 16458}, {128, 5472, 16403},
41     {135, 5470, 16350}, {142, 5467, 16284}, {149, 5465, 16225}, {156, 5463, 16163}, {163, 5463, 16113},
42     {170, 5463, 16058}, {177, 5463, 16001}, {184, 5463, 15948}, {191, 5461, 15896}, {198, 5461, 15843},
43     {205, 5461, 15793}, {212, 5461, 15742}, {219, 5461, 15690}, {226, 5461, 15637}, {233, 5458, 15587},
44     {240, 5458, 15532}, {247, 5458, 15480}, {254, 5458, 15425}, {261, 5456, 15372}
45 };
46 
47 EventDataInt sampleData5 = {
48     {100, 5479, 16579}, {107, 5479, 16542}, {114, 5479, 16497}, {121, 5476, 16458}, {128, 5472, 16403},
49     {135, 5470, 16350}, {142, 5467, 16284}, {149, 5465, 16225}, {156, 5463, 16163}, {163, 5463, 16113},
50     {170, 5463, 16058}, {177, 5463, 16001}, {184, 5463, 15948}, {191, 5461, 15896}, {198, 5461, 15843},
51     {205, 5461, 15793}, {212, 5461, 15742}, {219, 5461, 15690}, {226, 5461, 15637}, {233, 5458, 15587},
52     {240, 5458, 15532}, {247, 5458, 15480}, {254, 5458, 15425}, {261, 5456, 15372}, {268, 5456, 15317}
53 };
54 
55 EventDataInt sampleData6 = {
56     {100, 5479, 16579}, {107, 5479, 16542}, {114, 5479, 16497}, {121, 5476, 16458}, {128, 5472, 16403},
57     {135, 5470, 16350}, {142, 5467, 16284}, {149, 5465, 16225}, {156, 5463, 16163}, {163, 5463, 16113},
58     {170, 5463, 16058}, {177, 5463, 16001}, {184, 5463, 15948}, {191, 5461, 15896}, {198, 5461, 15843},
59     {205, 5461, 15793}, {212, 5461, 15742}, {219, 5461, 15690}, {226, 5461, 15637}, {233, 5458, 15587},
60     {240, 5458, 15532}, {247, 5458, 15480}, {254, 5458, 15425}, {261, 5456, 15372}, {268, 5456, 15317},
61     {275, 5456, 15267}
62 };
63 
64 EventDataInt sampleData7 = {
65     {100, 5479, 16579}, {107, 5479, 16542}, {114, 5479, 16497}, {121, 5476, 16458}, {128, 5472, 16403},
66     {135, 5470, 16350}, {142, 5467, 16284}, {149, 5465, 16225}, {156, 5463, 16163}, {163, 5463, 16113},
67     {170, 5463, 16058}, {177, 5463, 16001}, {184, 5463, 15948}, {191, 5461, 15896}, {198, 5461, 15843}
68 };
69 
70 std::vector<EventDataInt> sampleDatas = {
71     sampleData1, sampleData2, sampleData3,
72     sampleData4, sampleData5, sampleData6,
73     sampleData7
74 };
75 
76 EventDataInt flagShipLowSpeed1 = {
77     {53004, 5479, 16579}, {53087, 5479, 16542}, {53095, 5479, 16497}, {53102, 5476, 16458}, {53110, 5472, 16403},
78     {53116, 5470, 16350}, {53124, 5467, 16284}, {53130, 5465, 16225}, {53138, 5463, 16163}, {53145, 5463, 16113},
79     {53152, 5463, 16058}, {53159, 5463, 16001}, {53166, 5463, 15948}, {53173, 5461, 15896}, {53181, 5461, 15843},
80     {53188, 5461, 15793}, {53196, 5461, 15742}, {53203, 5461, 15690}, {53211, 5461, 15637}, {53218, 5458, 15587},
81     {53225, 5458, 15532}, {53232, 5458, 15480}, {53239, 5458, 15425}, {53245, 5456, 15372}, {53253, 5456, 15317},
82     {53261, 5456, 15267}, {53268, 5456, 15217}, {53276, 5456, 15162}, {53283, 5456, 15109}, {53290, 5454, 15057},
83     {53297, 5454, 15004}, {53304, 5454, 14952}, {53312, 5454, 14897}, {53319, 5452, 14844}, {53326, 5452, 14790},
84     {53333, 5449, 14737}, {53341, 5445, 14682}, {53347, 5445, 14627}, {53355, 5445, 14570}
85 };
86 
87 EventDataInt flagShipLowSpeed2 = {
88     {47556, 5479, 16567}, {47625, 5479, 16561}, {47632, 5479, 16554}, {47639, 5476, 16510}, {47646, 5472, 16455},
89     {47653, 5470, 16412}, {47661, 5467, 16366}, {47667, 5465, 16321}, {47675, 5463, 16273}, {47682, 5461, 16236},
90     {47689, 5458, 16186}, {47696, 5456, 16135}, {47704, 5454, 16083}, {47711, 5454, 16035}, {47718, 5454, 15980},
91     {47725, 5454, 15928}, {47733, 5454, 15873}, {47740, 5452, 15820}, {47748, 5452, 15768}, {47754, 5452, 15717},
92     {47762, 5452, 15667}, {47768, 5449, 15612}, {47775, 5449, 15557}, {47783, 5449, 15502}, {47790, 5449, 15448},
93     {47797, 5449, 15393}, {47804, 5449, 15338}, {47811, 5447, 15288}, {47819, 5447, 15237}, {47826, 5447, 15183},
94     {47833, 5447, 15130}, {47840, 5445, 15077}, {47848, 5445, 15023}, {47856, 5443, 14968}, {47864, 5443, 14913},
95     {47870, 5443, 14863}, {47878, 5443, 14808}, {47884, 5443, 14753}, {47892, 5443, 14698}, {47899, 5443, 14643},
96     {47906, 5443, 14588}, {47914, 5443, 14522}, {47921, 5443, 14451}
97 };
98 
99 EventDataInt flagShipLowSpeed3 = {
100     {42651, 5474, 16567}, {42720, 5474, 16565}, {42728, 5474, 16561}, {42735, 5474, 16519}, {42742, 5474, 16471},
101     {42749, 5472, 16442}, {42756, 5467, 16401}, {42762, 5465, 16348}, {42769, 5463, 16298}, {42778, 5461, 16259},
102     {42785, 5458, 16209}, {42792, 5458, 16158}, {42800, 5458, 16106}, {42806, 5456, 16049}, {42814, 5456, 15992},
103     {42821, 5454, 15939}, {42829, 5454, 15889}, {42835, 5454, 15838}, {42842, 5454, 15788}, {42850, 5452, 15736},
104     {42858, 5452, 15685}, {42864, 5452, 15633}, {42872, 5452, 15578}, {42879, 5449, 15525}, {42887, 5449, 15470},
105     {42894, 5449, 15418}, {42901, 5449, 15363}, {42908, 5447, 15311}, {42916, 5447, 15260}, {42922, 5447, 15205},
106     {42930, 5447, 15153}, {42937, 5445, 15100}, {42944, 5445, 15048}, {42952, 5445, 14995}, {42959, 5445, 14940},
107     {42966, 5443, 14888}, {42973, 5443, 14833}, {42981, 5443, 14778}, {42988, 5443, 14723}, {42995, 5443, 14664},
108     {43002, 5443, 14609}, {43009, 5445, 14545}, {43017, 5445, 14479}
109 };
110 
111 EventDataInt flagShipLowSpeed4 = {
112     {37198, 5481, 16565}, {37261, 5481, 16561}, {37268, 5481, 16554}, {37276, 5476, 16515}, {37283, 5472, 16460},
113     {37289, 5470, 16421}, {37297, 5467, 16382}, {37304, 5465, 16332}, {37311, 5463, 16279}, {37318, 5461, 16241},
114     {37325, 5458, 16190}, {37333, 5458, 16140}, {37340, 5458, 16087}, {37346, 5456, 16033}, {37354, 5456, 15980},
115     {37362, 5454, 15925}, {37370, 5454, 15870}, {37376, 5452, 15820}, {37384, 5452, 15768}, {37391, 5449, 15715},
116     {37398, 5449, 15662}, {37405, 5449, 15610}, {37413, 5449, 15557}, {37420, 5449, 15500}, {37428, 5449, 15445},
117     {37434, 5449, 15393}, {37442, 5449, 15338}, {37449, 5447, 15288}, {37456, 5447, 15237}, {37463, 5447, 15183},
118     {37470, 5447, 15130}, {37478, 5445, 15077}, {37486, 5445, 15025}, {37492, 5443, 14970}, {37499, 5443, 14915},
119     {37507, 5443, 14865}, {37514, 5443, 14815}, {37521, 5443, 14758}, {37529, 5443, 14703}, {37534, 5443, 14648},
120     {37542, 5443, 14588}, {37550, 5443, 14524}, {37557, 5443, 14454}
121 };
122 
123 EventDataInt flagShipLowSpeed5 = {
124     {31499, 5481, 16570}, {31568, 5479, 16540}, {31575, 5474, 16503}, {31582, 5472, 16465}, {31589, 5470, 16417},
125     {31597, 5465, 16371}, {31604, 5458, 16321}, {31611, 5458, 16282}, {31618, 5458, 16229}, {31625, 5456, 16172},
126     {31633, 5454, 16122}, {31640, 5454, 16069}, {31648, 5454, 16017}, {31654, 5454, 15962}, {31661, 5454, 15907},
127     {31669, 5454, 15854}, {31676, 5454, 15802}, {31683, 5452, 15754}, {31691, 5452, 15704}, {31697, 5449, 15649},
128     {31705, 5449, 15596}, {31713, 5447, 15544}, {31721, 5447, 15491}, {31727, 5447, 15438}, {31734, 5447, 15384},
129     {31741, 5447, 15329}, {31749, 5447, 15274}, {31755, 5447, 15224}, {31763, 5447, 15171}, {31769, 5445, 15119},
130     {31777, 5445, 15066}, {31785, 5445, 15013}, {31792, 5445, 14961}, {31799, 5443, 14908}, {31806, 5443, 14853},
131     {31814, 5443, 14801}, {31821, 5443, 14746}, {31828, 5443, 14689}, {31836, 5443, 14630}, {31843, 5443, 14572},
132     {31850, 5443, 14515}
133 };
134 
135 EventDataInt flagShipLowSpeed6 = {
136     {26883, 5467, 16574}, {26952, 5467, 16572}, {26959, 5467, 16570}, {26968, 5467, 16533}, {26975, 5467, 16487},
137     {26982, 5467, 16451}, {26989, 5467, 16407}, {26996, 5465, 16366}, {27003, 5461, 16316}, {27010, 5461, 16277},
138     {27018, 5461, 16227}, {27024, 5458, 16177}, {27032, 5454, 16122}, {27039, 5454, 16071}, {27047, 5454, 16017},
139     {27053, 5454, 15960}, {27061, 5454, 15905}, {27068, 5454, 15854}, {27075, 5454, 15804}, {27083, 5452, 15752},
140     {27090, 5452, 15697}, {27097, 5452, 15644}, {27105, 5452, 15589}, {27112, 5449, 15537}, {27119, 5449, 15482},
141     {27126, 5447, 15427}, {27133, 5447, 15372}, {27140, 5445, 15322}, {27148, 5445, 15269}, {27155, 5445, 15219},
142     {27163, 5445, 15169}, {27170, 5443, 15116}, {27177, 5443, 15061}, {27184, 5443, 15007}, {27192, 5443, 14952},
143     {27199, 5443, 14897}, {27206, 5443, 14842}, {27213, 5440, 14792}, {27220, 5440, 14737}, {27227, 5440, 14682},
144     {27234, 5440, 14627}, {27241, 5443, 14563}, {27249, 5443, 14497}
145 };
146 
147 EventDataInt flagShipLowSpeed7 = {
148     {22224, 5481, 16570}, {22292, 5481, 16565}, {22300, 5481, 16558}, {22308, 5476, 16522}, {22315, 5472, 16471},
149     {22322, 5467, 16430}, {22329, 5465, 16389}, {22337, 5463, 16343}, {22344, 5461, 16293}, {22351, 5461, 16257},
150     {22359, 5461, 16206}, {22365, 5458, 16154}, {22373, 5454, 16099}, {22379, 5454, 16046}, {22386, 5454, 15992},
151     {22394, 5452, 15937}, {22402, 5452, 15884}, {22409, 5452, 15834}, {22417, 5452, 15784}, {22424, 5449, 15731},
152     {22431, 5449, 15681}, {22438, 5449, 15626}, {22445, 5449, 15571}, {22453, 5447, 15516}, {22460, 5447, 15461},
153     {22467, 5447, 15407}, {22475, 5447, 15352}, {22481, 5445, 15299}, {22488, 5445, 15249}, {22495, 5443, 15194},
154     {22503, 5443, 15141}, {22510, 5443, 15089}, {22517, 5443, 15036}, {22525, 5443, 14984}, {22532, 5443, 14931},
155     {22539, 5440, 14879}, {22547, 5440, 14826}, {22554, 5440, 14774}, {22562, 5440, 14719}, {22567, 5440, 14662},
156     {22575, 5440, 14602}, {22582, 5443, 14545}, {22589, 5447, 14479}
157 };
158 
159 EventDataInt flagShipLowSpeed8 = {
160     {16574, 5490, 16570}, {16643, 5488, 16561}, {16650, 5483, 16551}, {16656, 5481, 16529}, {16664, 5479, 16492},
161     {16671, 5472, 16419}, {16678, 5470, 16371}, {16685, 5467, 16327}, {16693, 5465, 16279}, {16700, 5463, 16243},
162     {16707, 5461, 16197}, {16715, 5461, 16149}, {16722, 5461, 16097}, {16729, 5458, 16039}, {16736, 5458, 15987},
163     {16744, 5456, 15934}, {16751, 5456, 15882}, {16757, 5456, 15829}, {16764, 5456, 15777}, {16772, 5454, 15726},
164     {16779, 5454, 15676}, {16787, 5452, 15619}, {16794, 5452, 15564}, {16801, 5449, 15509}, {16809, 5449, 15454},
165     {16816, 5449, 15402}, {16823, 5449, 15349}, {16830, 5449, 15297}, {16837, 5449, 15244}, {16845, 5449, 15192},
166     {16852, 5449, 15139}, {16861, 5447, 15087}, {16868, 5447, 15034}, {16873, 5447, 14981}, {16880, 5447, 14927},
167     {16888, 5445, 14874}, {16896, 5445, 14819}, {16902, 5445, 14767}, {16910, 5445, 14712}, {16917, 5445, 14655},
168     {16924, 5445, 14595}, {16931, 5445, 14531}, {16939, 5445, 14465}
169 };
170 
171 EventDataInt flagShipLowSpeed9 = {
172     {10881, 5481, 16570}, {10950, 5481, 16565}, {10957, 5481, 16558}, {10965, 5479, 16524}, {10972, 5474, 16478},
173     {10979, 5472, 16430}, {10986, 5470, 16380}, {10993, 5467, 16334}, {11000, 5465, 16291}, {11008, 5465, 16254},
174     {11015, 5465, 16204}, {11021, 5463, 16151}, {11029, 5458, 16097}, {11036, 5458, 16044}, {11044, 5458, 15992},
175     {11051, 5456, 15937}, {11058, 5456, 15884}, {11065, 5456, 15832}, {11072, 5456, 15779}, {11080, 5454, 15729},
176     {11088, 5454, 15678}, {11094, 5452, 15621}, {11101, 5452, 15566}, {11108, 5452, 15514}, {11115, 5452, 15459},
177     {11123, 5452, 15404}, {11131, 5452, 15349}, {11138, 5449, 15299}, {11146, 5449, 15249}, {11152, 5449, 15194},
178     {11160, 5449, 15141}, {11168, 5447, 15089}, {11175, 5447, 15036}, {11181, 5447, 14984}, {11188, 5447, 14929},
179     {11198, 5447, 14874}, {11205, 5447, 14819}, {11210, 5447, 14767}, {11217, 5447, 14712}, {11225, 5447, 14657},
180     {11232, 5447, 14598}, {11239, 5447, 14536}, {11247, 5447, 14470}
181 };
182 
183 EventDataInt flagShipLowSpeed10 = {
184     {6437, 5481, 16567}, {6507, 5479, 16545}, {6515, 5476, 16519}, {6521, 5474, 16478}, {6529, 5472, 16428},
185     {6535, 5467, 16385}, {6543, 5461, 16334}, {6550, 5461, 16295}, {6557, 5461, 16243}, {6565, 5458, 16183},
186     {6572, 5456, 16131}, {6579, 5456, 16078}, {6586, 5456, 16026}, {6592, 5456, 15971}, {6600, 5456, 15921},
187     {6607, 5456, 15868}, {6615, 5456, 15818}, {6623, 5454, 15768}, {6630, 5454, 15717}, {6637, 5454, 15667},
188     {6644, 5454, 15614}, {6652, 5452, 15560}, {6659, 5452, 15505}, {6665, 5452, 15452}, {6673, 5452, 15397},
189     {6681, 5449, 15345}, {6688, 5449, 15295}, {6695, 5449, 15240}, {6702, 5449, 15187}, {6709, 5447, 15135},
190     {6717, 5447, 15082}, {6724, 5447, 15029}, {6731, 5447, 14975}, {6738, 5445, 14922}, {6745, 5445, 14867},
191     {6752, 5445, 14815}, {6759, 5445, 14760}, {6767, 5445, 14703}, {6774, 5445, 14643}, {6783, 5445, 14586},
192     {6790, 5445, 14529}
193 };
194 
195 std::vector<EventDataInt> flagShipLowSpeedDatas = {
196     flagShipLowSpeed1, flagShipLowSpeed2, flagShipLowSpeed3, flagShipLowSpeed4, flagShipLowSpeed5,
197     flagShipLowSpeed6, flagShipLowSpeed7, flagShipLowSpeed8, flagShipLowSpeed9, flagShipLowSpeed10
198 };
199 
200 EventDataFloat justPans1 = {
201     {1225602910000, 934.125000, 1819.000000}, {1225609796000, 934.125000, 1819.000000},
202     {1225615079000, 952.750000, 1774.750000}, {1225621657000, 975.875000, 1719.750000},
203     {1225627576000, 999.000000, 1669.750000}, {1225634524000, 1029.250000, 1604.875000},
204     {1225640754000, 1051.250000, 1582.375000}, {1225647327000, 1085.625000, 1550.750000},
205     {1225653292000, 1085.625000, 1550.750000}
206 };
207 
208 EventDataFloat justPans2 = {
209     {1435133099000, 947.125000, 1873.375000}, {1435138362000, 947.125000, 1873.375000},
210     {1435145646000, 947.125000, 1873.375000}, {1435152440000, 947.125000, 1873.375000},
211     {1435158860000, 947.125000, 1870.625000}, {1435165623000, 947.125000, 1867.500000},
212     {1435172735000, 949.375000, 1845.750000}, {1435179593000, 952.500000, 1815.000000},
213     {1435185979000, 959.875000, 1774.125000}, {1435192802000, 969.750000, 1723.375000},
214     {1435199055000, 984.625000, 1683.000000}, {1435205968000, 1006.375000, 1632.000000},
215     {1435212773000, 1032.000000, 1576.375000}, {1435219400000, 1057.750000, 1528.250000},
216     {1435225848000, 1089.875000, 1460.250000}, {1435232596000, 1118.375000, 1401.875000},
217     {1435238772000, 1140.875000, 1358.375000}, {1435245716000, 1164.625000, 1314.125000},
218     {1435253518000, 1168.000000, 1287.875000}, {1435260417000, 1170.250000, 1251.000000},
219     {1435265404000, 1170.250000, 1251.000000}
220 };
221 
222 EventDataFloat justPans3 = {
223     {1620886380000, 918.875000, 2044.875000}, {1620893718000, 918.875000, 2044.875000},
224     {1620898368000, 918.875000, 2044.875000}, {1620905149000, 918.875000, 2044.875000},
225     {1620911165000, 919.250000, 2035.875000}, {1620918177000, 919.250000, 2024.625000},
226     {1620924082000, 925.125000, 1990.125000}, {1620930688000, 933.625000, 1938.875000},
227     {1620937525000, 942.625000, 1884.125000}, {1620944341000, 950.500000, 1836.750000},
228     {1620950741000, 961.750000, 1780.000000}, {1620957415000, 974.500000, 1718.250000},
229     {1620964743000, 991.375000, 1688.125000}, {1620971639000, 1019.125000, 1643.250000},
230     {1620977195000, 1019.125000, 1643.250000}
231 };
232 
233 EventDataFloat justPans4 = {
234     {1693508313000, 876.625000, 2081.250000}, {1693515364000, 876.625000, 2081.250000},
235     {1693520533000, 878.875000, 2075.000000}, {1693527316000, 881.625000, 2067.500000},
236     {1693533422000, 891.250000, 2018.375000}, {1693540211000, 906.000000, 1944.250000},
237     {1693546719000, 924.000000, 1898.750000}, {1693553516000, 947.750000, 1850.250000},
238     {1693560792000, 979.250000, 1774.375000}, {1693567558000, 1004.125000, 1716.875000},
239     {1693573720000, 1029.500000, 1689.500000}, {1693580515000, 1072.125000, 1647.750000},
240     {1693585880000, 1072.125000, 1647.750000}
241 };
242 
243 EventDataFloat justPans5 = {
244     {2099916684000, 961.500000, 1771.625000}, {2099923688000, 961.500000, 1771.625000},
245     {2099928177000, 995.375000, 1698.500000}, {2099934888000, 1037.375000, 1608.000000},
246     {2099943214000, 1065.625000, 1576.375000}, {2099949954000, 1111.375000, 1525.625000},
247     {2099953559000, 1111.375000, 1525.625000}
248 };
249 
250 EventDataFloat justPans6 = {
251     {2160394432000, 930.750000, 1906.125000}, {2160401230000, 930.750000, 1906.125000},
252     {2160406116000, 930.750000, 1906.125000}, {2160412802000, 930.750000, 1906.125000},
253     {2160419336000, 930.750000, 1906.125000}, {2160426294000, 930.750000, 1906.125000},
254     {2160432188000, 932.500000, 1898.500000}, {2160438886000, 934.375000, 1889.750000},
255     {2160445899000, 939.500000, 1875.625000}, {2160452792000, 947.125000, 1854.250000},
256     {2160458695000, 959.000000, 1827.125000}, {2160465382000, 973.375000, 1795.875000},
257     {2160472331000, 988.625000, 1761.125000}, {2160479137000, 1002.750000, 1729.250000},
258     {2160485765000, 1014.000000, 1705.375000}, {2160492527000, 1026.625000, 1680.000000},
259     {2160499030000, 1040.250000, 1657.375000}, {2160505930000, 1055.750000, 1633.625000},
260     {2160512692000, 1073.250000, 1608.250000}, {2160519333000, 1091.250000, 1584.375000},
261     {2160525234000, 1108.250000, 1559.500000}, {2160532110000, 1122.375000, 1538.875000},
262     {2160538897000, 1131.375000, 1523.750000}, {2160545523000, 1139.750000, 1509.000000},
263     {2160551745000, 1139.750000, 1509.000000}
264 };
265 
266 EventDataFloat justPans7 = {
267     {2190471483000, 920.000000, 2039.500000}, {2190478391000, 920.000000, 2039.500000},
268     {2190483214000, 920.875000, 2037.875000}, {2190490132000, 922.000000, 2035.875000},
269     {2190495775000, 926.250000, 2018.625000}, {2190502659000, 933.250000, 1990.750000},
270     {2190509243000, 948.250000, 1936.625000}, {2190516142000, 961.500000, 1888.375000},
271     {2190522568000, 975.875000, 1856.750000}, {2190529704000, 994.750000, 1817.625000},
272     {2190535779000, 1018.750000, 1761.125000}, {2190542446000, 1042.500000, 1707.000000},
273     {2190548752000, 1060.875000, 1687.000000}, {2190555535000, 1088.500000, 1661.625000},
274     {2190562387000, 1088.500000, 1661.625000}
275 };
276 
277 EventDataFloat justPans8 = {
278     {2328148688000, 902.875000, 1989.875000}, {2328155719000, 902.875000, 1989.875000},
279     {2328160307000, 904.250000, 1977.750000}, {2328167277000, 905.625000, 1963.625000},
280     {2328173458000, 916.625000, 1932.125000}, {2328180350000, 934.750000, 1879.000000},
281     {2328186775000, 960.625000, 1813.875000}, {2328193475000, 984.125000, 1761.500000},
282     {2328200560000, 1004.375000, 1731.500000}, {2328207376000, 1032.625000, 1695.750000},
283     {2328212806000, 1032.625000, 1695.750000}
284 };
285 
286 EventDataFloat justPans9 = {
287     {2555863772000, 904.875000, 1899.000000}, {2555870635000, 904.875000, 1899.000000},
288     {2555875516000, 913.875000, 1877.875000}, {2555882362000, 925.125000, 1851.375000},
289     {2555888643000, 950.500000, 1797.000000}, {2555895362000, 982.625000, 1727.875000},
290     {2555903142000, 1002.750000, 1691.250000}, {2555909853000, 1027.000000, 1648.625000},
291     {2555915531000, 1051.250000, 1614.250000}, {2555922056000, 1078.875000, 1578.625000},
292     {2555928571000, 1099.125000, 1546.000000}, {2555935123000, 1112.750000, 1522.500000},
293     {2555941038000, 1112.750000, 1522.500000}
294 };
295 
296 EventDataFloat justPans10 = {
297     {2637406993000, 862.750000, 1984.500000}, {2637412646000, 862.750000, 1984.500000},
298     {2637418800000, 862.750000, 1984.500000}, {2637425566000, 862.750000, 1984.500000},
299     {2637431722000, 865.375000, 1963.375000}, {2637438512000, 868.125000, 1936.875000},
300     {2637445718000, 882.000000, 1892.875000}, {2637452387000, 903.625000, 1824.625000},
301     {2637458706000, 928.750000, 1753.000000}, {2637465501000, 950.750000, 1696.000000},
302     {2637471620000, 973.625000, 1664.125000}, {2637478596000, 1008.125000, 1622.625000},
303     {2637485152000, 1061.375000, 1546.250000}, {2637491947000, 1089.250000, 1504.500000},
304     {2637497933000, 1105.125000, 1469.500000}, {2637504758000, 1121.750000, 1428.000000},
305     {2637511237000, 1121.750000, 1428.000000}
306 };
307 
308 EventDataFloat justPans11 = {
309     {2741534377000, 919.750000, 2012.750000}, {2741541325000, 919.750000, 2012.750000},
310     {2741545886000, 919.750000, 2012.750000}, {2741552687000, 919.750000, 2012.750000},
311     {2741558934000, 921.125000, 2002.500000}, {2741565662000, 922.875000, 1990.750000},
312     {2741572099000, 934.375000, 1949.500000}, {2741578858000, 950.750000, 1888.625000},
313     {2741585266000, 970.500000, 1833.875000}, {2741591884000, 993.125000, 1776.125000},
314     {2741598776000, 1013.125000, 1735.250000}, {2741605638000, 1037.125000, 1692.000000},
315     {2741612064000, 1063.375000, 1652.500000}, {2741618747000, 1093.250000, 1614.250000},
316     {2741625551000, 1105.375000, 1585.750000}, {2741632475000, 1112.125000, 1560.000000},
317     {2741638346000, 1112.125000, 1560.000000}
318 };
319 
320 EventDataFloat justPans12 = {
321     {2772291397000, 867.875000, 2055.875000}, {2772298378000, 867.875000, 2055.875000},
322     {2772302996000, 867.875000, 2055.875000}, {2772309847000, 867.875000, 2055.875000},
323     {2772315783000, 868.125000, 2054.125000}, {2772322456000, 868.375000, 2052.250000},
324     {2772329395000, 873.500000, 2029.375000}, {2772336281000, 880.250000, 1997.750000},
325     {2772342369000, 890.750000, 1952.125000}, {2772349296000, 902.875000, 1899.875000},
326     {2772355782000, 914.125000, 1874.250000}, {2772362566000, 929.625000, 1841.500000},
327     {2772369044000, 946.250000, 1796.625000}, {2772375792000, 958.375000, 1764.250000},
328     {2772382366000, 973.125000, 1738.250000}, {2772389138000, 992.000000, 1707.875000},
329     {2772395685000, 1008.375000, 1677.375000}, {2772402307000, 1020.250000, 1656.750000},
330     {2772408557000, 1025.875000, 1650.250000}, {2772415113000, 1031.500000, 1646.875000},
331     {2772421479000, 1031.500000, 1646.875000}
332 };
333 
334 EventDataFloat justPans13 = {
335     {2772291397000, 818.875000, 307.875000}, {2772298378000, 818.875000, 307.875000},
336     {2772302996000, 818.875000, 307.875000}, {2772309847000, 818.875000, 307.875000},
337     {2772315783000, 819.125000, 306.125000}, {2772322456000, 819.375000, 304.250000},
338     {2772329395000, 824.500000, 281.375000}, {2772336281000, 831.250000, 249.750000},
339     {2772342369000, 841.750000, 204.125000}
340 };
341 
342 EventDataFloat justPans14 = {
343     {2772291397000, 867.875000, 2057.875000}, {2772298378000, 867.875000, 2057.875000},
344     {2772302996000, 867.875000, 2057.875000}, {2772309847000, 867.875000, 2057.875000},
345     {2772315783000, 868.125000, 2056.125000}, {2772322456000, 868.375000, 2054.250000},
346     {2772329395000, 873.500000, 2031.375000}, {2772421479000, 1031.500000, 1648.875000}
347 };
348 
349 EventDataFloat justPans15 = {
350     {2827614083000, 852.625000, 2034.375000}, {2827619527000, 852.625000, 2034.375000},
351     {2827626733000, 852.625000, 2034.375000}, {2827633448000, 852.625000, 2034.375000},
352     {2827639919000, 855.750000, 2026.500000}, {2827646714000, 859.375000, 2016.875000},
353     {2827653367000, 867.000000, 1988.500000}, {2827660295000, 878.250000, 1945.875000},
354     {2827666564000, 890.750000, 1889.500000}, {2827673419000, 903.625000, 1826.875000},
355     {2827680286000, 918.375000, 1800.625000}, {2827687011000, 940.625000, 1766.500000},
356     {2827693121000, 940.625000, 1766.500000}
357 };
358 
359 EventDataFloat justPans16 = {
360     {2827614083000, 852.625000, 2036.375000}, {2827619527000, 852.625000, 2036.375000},
361     {2827626733000, 852.625000, 2036.375000}, {2827633448000, 852.625000, 2036.375000},
362     {2827639919000, 855.750000, 2028.500000}, {2827693121000, 940.625000, 1768.500000}
363 };
364 
365 EventDataFloat justPans17 = {
366     {2859372351000, 907.375000, 1867.125000}, {2859379266000, 907.375000, 1867.125000},
367     {2859384118000, 907.375000, 1867.125000}, {2859391033000, 907.375000, 1867.125000},
368     {2859396990000, 912.375000, 1852.250000}, {2859403682000, 918.375000, 1834.750000},
369     {2859410345000, 935.000000, 1787.125000}, {2859417152000, 957.000000, 1724.500000},
370     {2859423651000, 969.375000, 1689.500000}, {2859430391000, 984.375000, 1647.750000},
371     {2859437171000, 999.625000, 1604.625000}, {2859444058000, 1014.250000, 1563.125000},
372     {2859449867000, 1025.500000, 1553.000000}, {2859456577000, 1044.125000, 1539.125000},
373     {2859462473000, 1044.125000, 1539.125000}
374 };
375 
376 EventDataFloat justPans18 = {
377     {2859372351000, 858.375000, 81.125000}, {2859379266000, 858.375000, 81.125000},
378     {2859384118000, 858.375000, 81.125000}, {2859391033000, 858.375000, 81.125000},
379     {2859396990000, 863.375000, 66.250000}, {2859403682000, 869.375000, 48.750000},
380     {2859410345000, 886.000000, 1.125000}
381 };
382 
383 EventDataFloat justPans19 = {
384     {2859372351000, 907.375000, 1871.125000}, {2859379266000, 907.375000, 1871.125000},
385     {2859384118000, 907.375000, 1871.125000}, {2859391033000, 907.375000, 1871.125000},
386     {2859396990000, 912.375000, 1856.250000}, {2859462473000, 1044.125000, 1543.125000}
387 };
388 
389 EventDataFloat justPans20 = {
390     {2929004224000, 856.625000, 1954.625000}, {2929009553000, 856.625000, 1954.625000},
391     {2929016223000, 856.625000, 1954.625000}, {2929024108000, 856.625000, 1954.625000},
392     {2929029693000, 856.625000, 1954.625000}, {2929036413000, 856.625000, 1954.625000},
393     {2929043214000, 863.875000, 1927.500000}, {2929050095000, 872.625000, 1894.250000},
394     {2929056753000, 883.125000, 1851.125000}, {2929063484000, 896.125000, 1798.125000},
395     {2929069655000, 910.125000, 1767.375000}, {2929076472000, 929.625000, 1727.000000},
396     {2929082915000, 954.500000, 1669.250000}, {2929089741000, 978.125000, 1616.125000},
397     {2929096256000, 997.625000, 1589.125000}, {2929103015000, 1023.625000, 1557.250000},
398     {2929109082000, 1023.625000, 1557.250000}
399 };
400 
401 EventDataFloat justPans21 = {
402     {2929004224000, 856.625000, 1956.625000}, {2929009553000, 856.625000, 1956.625000},
403     {2929016223000, 856.625000, 1956.625000}, {2929024108000, 856.625000, 1956.625000},
404     {2929029693000, 856.625000, 1956.625000}, {2929036413000, 856.625000, 1956.625000},
405     {2929109082000, 1023.625000, 1559.250000}
406 };
407 
408 std::vector<EventDataFloat> justPanDatas = {
409     justPans1, justPans2, justPans3, justPans4, justPans5, justPans6, justPans7,
410     justPans8, justPans9, justPans10, justPans11, justPans12, justPans13, justPans14,
411     justPans15, justPans16, justPans17, justPans18, justPans19, justPans20, justPans21
412 };
413 }
414 
415 /**
416  * @tc.name: sampleDatas1
417  * @tc.desc: Test UpdateVelocity
418  * @tc.type: FUNC
419  */
420 HWTEST_F(VelocityTrackerTest, sampleDatas1, TestSize.Level1)
421 {
422     SystemProperties::velocityTrackerPointNumber_ = 5;
423     SystemProperties::isVelocityWithinTimeWindow_ = false;
424     SystemProperties::isVelocityWithoutUpPoint_ = false;
425     VelocityTracker velocityTracker;
426     for (auto cnt = 0; cnt < sampleDatas.size(); ++cnt) {
427         velocityTracker.Reset();
428         for (auto i = 0; i < sampleDatas[cnt].size(); ++i) {
429             std::vector<int32_t> point = sampleDatas[cnt][i];
430             std::chrono::microseconds microseconds(point[0] * RATIO_MS_TO_US);
431             TimeStamp timeStamp(microseconds);
432             TouchEvent touchEvent;
433             touchEvent.x = point[1] / TO_TRUE_DATA;
434             touchEvent.y = point[2] / TO_TRUE_DATA;
435             touchEvent.time = timeStamp;
436             float range = TOUCH_STILL_THRESHOLD;
437             bool end = false;
438             if (i == sampleDatas[cnt].size() - 1)
439                 end = true;
440             velocityTracker.UpdateTouchPoint(touchEvent, end, range);
441         }
442         velocityTracker.UpdateVelocity();
443     }
444     EXPECT_EQ(velocityTracker.velocity_.GetVelocityX(), 0.0);
445 }
446 
447 /**
448  * @tc.name: sampleDatas2
449  * @tc.desc: Test UpdateVelocity
450  * @tc.type: FUNC
451  */
452 HWTEST_F(VelocityTrackerTest, sampleDatas2, TestSize.Level1)
453 {
454     SystemProperties::velocityTrackerPointNumber_ = 20;
455     SystemProperties::isVelocityWithinTimeWindow_ = true;
456     SystemProperties::isVelocityWithoutUpPoint_ = true;
457     VelocityTracker velocityTracker;
458     for (auto cnt = 0; cnt < sampleDatas.size(); ++cnt) {
459         velocityTracker.Reset();
460         for (auto i = 0; i < sampleDatas[cnt].size(); ++i) {
461             std::vector<int32_t> point = sampleDatas[cnt][i];
462             std::chrono::microseconds microseconds(point[0] * RATIO_MS_TO_US);
463             TimeStamp timeStamp(microseconds);
464             TouchEvent touchEvent;
465             touchEvent.x = point[1] / TO_TRUE_DATA;
466             touchEvent.y = point[2] / TO_TRUE_DATA;
467             touchEvent.time = timeStamp;
468             float range = TOUCH_STILL_THRESHOLD;
469             bool end = false;
470             if (i == sampleDatas[cnt].size() - 1)
471                 end = true;
472             velocityTracker.UpdateTouchPoint(touchEvent, end, range);
473         }
474         velocityTracker.UpdateVelocity();
475     }
476     EXPECT_NE(velocityTracker.velocity_.GetVelocityX(), 0.0);
477 }
478 
479 /**
480  * @tc.name: flagShipLowSpeedDatas
481  * @tc.desc: Test UpdateVelocity
482  * @tc.type: FUNC
483  */
484 HWTEST_F(VelocityTrackerTest, flagShipLowSpeedDatas, TestSize.Level1)
485 {
486     SystemProperties::velocityTrackerPointNumber_ = 5;
487     SystemProperties::isVelocityWithinTimeWindow_ = false;
488     SystemProperties::isVelocityWithoutUpPoint_ = false;
489     VelocityTracker velocityTracker;
490     for (auto cnt = 0; cnt < flagShipLowSpeedDatas.size(); ++cnt) {
491         velocityTracker.Reset();
492         for (auto i = 0; i < flagShipLowSpeedDatas[cnt].size(); ++i) {
493             std::vector<int32_t> point = flagShipLowSpeedDatas[cnt][i];
494             std::chrono::microseconds microseconds(point[0] * RATIO_MS_TO_US);
495             TimeStamp timeStamp(microseconds);
496             TouchEvent touchEvent;
497             touchEvent.x = point[1] / TO_TRUE_DATA;
498             touchEvent.y = point[2] / TO_TRUE_DATA;
499             touchEvent.time = timeStamp;
500             float range = TOUCH_STILL_THRESHOLD;
501             bool end = false;
502             if (i == flagShipLowSpeedDatas[cnt].size() - 1)
503                 end = true;
504             velocityTracker.UpdateTouchPoint(touchEvent, end, range);
505         }
506         velocityTracker.UpdateVelocity();
507     }
508     EXPECT_NE(velocityTracker.velocity_.GetVelocityX(), 0.0);
509 }
510 
511 /**
512  * @tc.name: justPanDatas
513  * @tc.desc: Test UpdateVelocity
514  * @tc.type: FUNC
515  */
516 HWTEST_F(VelocityTrackerTest, justPanDatas, TestSize.Level1)
517 {
518     SystemProperties::velocityTrackerPointNumber_ = 20;
519     SystemProperties::isVelocityWithinTimeWindow_ = true;
520     SystemProperties::isVelocityWithoutUpPoint_ = true;
521     VelocityTracker velocityTracker;
522     for (auto cnt = 0; cnt < justPanDatas.size(); ++cnt) {
523         velocityTracker.Reset();
524         for (auto i = 0; i < justPanDatas[cnt].size(); ++i) {
525             std::vector<float> point = justPanDatas[cnt][i];
526             std::chrono::microseconds microseconds(static_cast<int64_t>(point[0] / RATIO_NS_TO_US));
527             TimeStamp timeStamp(microseconds);
528             TouchEvent touchEvent;
529             touchEvent.x = point[1];
530             touchEvent.y = point[2];
531             touchEvent.time = timeStamp;
532             float range = TOUCH_STILL_THRESHOLD;
533             bool end = false;
534             if (i == justPanDatas[cnt].size() - 1)
535                 end = true;
536             velocityTracker.UpdateTouchPoint(touchEvent, end, range);
537         }
538         velocityTracker.UpdateVelocity();
539     }
540     EXPECT_NE(velocityTracker.velocity_.GetVelocityX(), 0.0);
541 }
542 
543 
544 } // namespace OHOS::Ace::NG
545