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 #include "gtest/gtest.h" 17 18 #define private public 19 #define protected public 20 21 #include "core/accessibility/js_inspector/inspect_badge.h" 22 #include "core/accessibility/js_inspector/inspect_button.h" 23 #include "core/accessibility/js_inspector/inspect_camera.h" 24 #include "core/accessibility/js_inspector/inspect_canvas.h" 25 #include "core/accessibility/js_inspector/inspect_chart.h" 26 #include "core/accessibility/js_inspector/inspect_dialog.h" 27 #include "core/accessibility/js_inspector/inspect_div.h" 28 #include "core/accessibility/js_inspector/inspect_divider.h" 29 #include "core/accessibility/js_inspector/inspect_form.h" 30 #include "core/accessibility/js_inspector/inspect_grid_column.h" 31 #include "core/accessibility/js_inspector/inspect_grid_container.h" 32 #include "core/accessibility/js_inspector/inspect_grid_row.h" 33 #include "core/accessibility/js_inspector/inspect_image_animator.h" 34 #include "core/accessibility/js_inspector/inspect_image.h" 35 #include "core/accessibility/js_inspector/inspect_input.h" 36 #include "core/accessibility/js_inspector/inspect_label.h" 37 #include "core/accessibility/js_inspector/inspect_list_item_group.h" 38 #include "core/accessibility/js_inspector/inspect_list_item.h" 39 #include "core/accessibility/js_inspector/inspect_list.h" 40 #include "core/accessibility/js_inspector/inspect_marquee.h" 41 #include "core/accessibility/js_inspector/inspect_menu.h" 42 #include "core/accessibility/js_inspector/inspect_navigation_bar.h" 43 #include "core/accessibility/js_inspector/inspect_node.h" 44 #include "core/accessibility/js_inspector/inspect_option.h" 45 #include "core/accessibility/js_inspector/inspect_panel.h" 46 #include "core/accessibility/js_inspector/inspect_picker.h" 47 #include "core/accessibility/js_inspector/inspect_picker_view.h" 48 #include "core/accessibility/js_inspector/inspect_piece.h" 49 #include "core/accessibility/js_inspector/inspect_popup.h" 50 #include "core/accessibility/js_inspector/inspect_progress.h" 51 #include "core/accessibility/js_inspector/inspect_qrcode.h" 52 #include "core/accessibility/js_inspector/inspect_rating.h" 53 #include "core/accessibility/js_inspector/inspect_refresh.h" 54 #include "core/accessibility/js_inspector/inspect_search.h" 55 #include "core/accessibility/js_inspector/inspect_select.h" 56 #include "core/accessibility/js_inspector/inspect_slider.h" 57 #include "core/accessibility/js_inspector/inspect_span.h" 58 #include "core/accessibility/js_inspector/inspect_stack.h" 59 #include "core/accessibility/js_inspector/inspect_stepper_item.h" 60 #include "core/accessibility/js_inspector/inspect_stepper.h" 61 #include "core/accessibility/js_inspector/inspect_swiper.h" 62 #include "core/accessibility/js_inspector/inspect_switch.h" 63 #include "core/accessibility/js_inspector/inspect_tab_bar.h" 64 #include "core/accessibility/js_inspector/inspect_tab_content.h" 65 #include "core/accessibility/js_inspector/inspect_tabs.h" 66 #include "core/accessibility/js_inspector/inspect_text.h" 67 #include "core/accessibility/js_inspector/inspect_textarea.h" 68 #include "core/accessibility/js_inspector/inspect_toggle.h" 69 #include "core/accessibility/js_inspector/inspect_toolbar_item.h" 70 #include "core/accessibility/js_inspector/inspect_toolbar.h" 71 #include "core/accessibility/js_inspector/inspect_video.h" 72 73 using namespace testing; 74 using namespace testing::ext; 75 namespace OHOS::Ace::Framework { 76 namespace { 77 constexpr char INSPECTOR_ATTRS[] = "$attrs"; 78 constexpr char INSPECTOR_STYLES[] = "$styles"; 79 } 80 class JSInspectorTest : public testing::Test { 81 public: SetUpTestSuite()82 static void SetUpTestSuite() {}; TearDownTestSuite()83 static void TearDownTestSuite() {}; 84 CheckToggleAttrAndStyle(InspectToggle & inspectToggle,uint16_t attrsSize,uint16_t stylesSize)85 void CheckToggleAttrAndStyle(InspectToggle& inspectToggle, uint16_t attrsSize, uint16_t stylesSize) 86 { 87 uint16_t attrsSizeInsert = 3; 88 uint16_t stylesSizeInsert = 4; 89 uint16_t insertTwo = 2; 90 DeviceType deviceType = SystemProperties::GetDeviceType(); 91 EXPECT_EQ(inspectToggle.attrs_["checked"], "false"); 92 EXPECT_EQ(inspectToggle.attrs_["disabled"], "false"); 93 EXPECT_EQ(inspectToggle.attrs_["focusable"], "false"); 94 if (deviceType == DeviceType::PHONE) { 95 EXPECT_EQ(inspectToggle.styles_["color"], "#ff007dff"); 96 EXPECT_EQ(inspectToggle.styles_["font-size"], "16px"); 97 stylesSizeInsert += insertTwo; 98 } else if (deviceType == DeviceType::TV) { 99 EXPECT_EQ(inspectToggle.styles_["color"], "#e5ffffff"); 100 EXPECT_EQ(inspectToggle.styles_["font-size"], "18px"); 101 stylesSizeInsert += insertTwo; 102 } else if (deviceType == DeviceType::WATCH) { 103 EXPECT_EQ(inspectToggle.styles_["color"], "#ff45a5ff"); 104 EXPECT_EQ(inspectToggle.styles_["font-size"], "16px"); 105 stylesSizeInsert += insertTwo; 106 } 107 EXPECT_EQ(inspectToggle.styles_["allow-scale"], "true"); 108 EXPECT_EQ(inspectToggle.styles_["font-style"], "normal"); 109 EXPECT_EQ(inspectToggle.styles_["font-weight"], "normal"); 110 EXPECT_EQ(inspectToggle.styles_["font-family"], "sans-serif"); 111 EXPECT_EQ(inspectToggle.styles_.find("border"), inspectToggle.styles_.end()); 112 EXPECT_EQ(inspectToggle.styles_.find("border-left-style"), inspectToggle.styles_.end()); 113 EXPECT_EQ(inspectToggle.styles_.find("border-top-style"), inspectToggle.styles_.end()); 114 EXPECT_EQ(inspectToggle.styles_.find("border-right-style"), inspectToggle.styles_.end()); 115 EXPECT_EQ(inspectToggle.styles_.find("border-bottom-style"), inspectToggle.styles_.end()); 116 EXPECT_EQ(inspectToggle.styles_.find("border-left-width"), inspectToggle.styles_.end()); 117 EXPECT_EQ(inspectToggle.styles_.find("border-top-width"), inspectToggle.styles_.end()); 118 EXPECT_EQ(inspectToggle.styles_.find("border-right-width"), inspectToggle.styles_.end()); 119 EXPECT_EQ(inspectToggle.styles_.find("border-bottom-width"), inspectToggle.styles_.end()); 120 EXPECT_EQ(inspectToggle.styles_.find("border-left-color"), inspectToggle.styles_.end()); 121 EXPECT_EQ(inspectToggle.styles_.find("border-top-color"), inspectToggle.styles_.end()); 122 EXPECT_EQ(inspectToggle.styles_.find("border-right-color"), inspectToggle.styles_.end()); 123 EXPECT_EQ(inspectToggle.styles_.find("border-bottom-color"), inspectToggle.styles_.end()); 124 EXPECT_EQ(inspectToggle.attrs_.size(), attrsSize + attrsSizeInsert); 125 EXPECT_EQ(inspectToggle.styles_.size(), stylesSize + stylesSizeInsert); 126 } 127 CheckTextAreaAttrAndStyle(InspectTextArea & inspectTextArea,uint16_t attrsSize,uint16_t stylesSize)128 void CheckTextAreaAttrAndStyle(InspectTextArea& inspectTextArea, uint16_t attrsSize, uint16_t stylesSize) 129 { 130 uint16_t attrsSizeInsert = 4; 131 uint16_t stylesSizeInsert = 3; 132 uint16_t insertThree = 3; 133 DeviceType deviceType = SystemProperties::GetDeviceType(); 134 EXPECT_EQ(inspectTextArea.attrs_["extend"], "false"); 135 EXPECT_EQ(inspectTextArea.attrs_["showcounter"], "false"); 136 EXPECT_EQ(inspectTextArea.attrs_["disabled"], "false"); 137 EXPECT_EQ(inspectTextArea.attrs_["focusable"], "true"); 138 if (deviceType == DeviceType::PHONE) { 139 EXPECT_EQ(inspectTextArea.styles_["color"], "#e6000000"); 140 EXPECT_EQ(inspectTextArea.styles_["font-size"], "16px"); 141 EXPECT_EQ(inspectTextArea.styles_["placeholder-color"], "#99000000"); 142 stylesSizeInsert += insertThree; 143 } else if (deviceType == DeviceType::TV) { 144 EXPECT_EQ(inspectTextArea.styles_["color"], "#e6ffffff"); 145 EXPECT_EQ(inspectTextArea.styles_["font-size"], "18px"); 146 EXPECT_EQ(inspectTextArea.styles_["placeholder-color"], "#99ffffff"); 147 stylesSizeInsert += insertThree; 148 } 149 EXPECT_EQ(inspectTextArea.styles_["allow-scale"], "true"); 150 EXPECT_EQ(inspectTextArea.styles_["font-weight"], "normal"); 151 EXPECT_EQ(inspectTextArea.styles_["font-family"], "sans-serif"); 152 EXPECT_EQ(inspectTextArea.attrs_.size(), attrsSize + attrsSizeInsert); 153 EXPECT_EQ(inspectTextArea.styles_.size(), stylesSize + stylesSizeInsert); 154 } 155 CheckTextAttrAndStyle(InspectText & inspectText,uint16_t attrsSize,uint16_t stylesSize)156 void CheckTextAttrAndStyle(InspectText& inspectText, uint16_t attrsSize, uint16_t stylesSize) 157 { 158 uint16_t attrsSizeInsert = 2; 159 uint16_t stylesSizeInsert = 11; 160 DeviceType deviceType = SystemProperties::GetDeviceType(); 161 EXPECT_EQ(inspectText.attrs_["disabled"], "false"); 162 EXPECT_EQ(inspectText.attrs_["focusable"], "false"); 163 if (deviceType == DeviceType::PHONE) { 164 EXPECT_EQ(inspectText.styles_["color"], "#e5000000"); 165 stylesSizeInsert++; 166 } else if (deviceType == DeviceType::TV) { 167 EXPECT_EQ(inspectText.styles_["color"], "#e5ffffff"); 168 stylesSizeInsert++; 169 } else if (deviceType == DeviceType::WATCH) { 170 EXPECT_EQ(inspectText.styles_["color"], "#ffffffff"); 171 stylesSizeInsert++; 172 } 173 EXPECT_EQ(inspectText.styles_["font-size"], "30px"); 174 EXPECT_EQ(inspectText.styles_["allow-scale"], "true"); 175 EXPECT_EQ(inspectText.styles_["letter-spacing"], "0px"); 176 EXPECT_EQ(inspectText.styles_["font-style"], "normal"); 177 EXPECT_EQ(inspectText.styles_["font-weight"], "normal"); 178 EXPECT_EQ(inspectText.styles_["text-decoration"], "none"); 179 EXPECT_EQ(inspectText.styles_["text-align"], "start"); 180 EXPECT_EQ(inspectText.styles_["line-height"], "0px"); 181 EXPECT_EQ(inspectText.styles_["text-overflow"], "clip"); 182 EXPECT_EQ(inspectText.styles_["font-family"], "sans-serif"); 183 EXPECT_EQ(inspectText.styles_["font-size-step"], "1px"); 184 EXPECT_EQ(inspectText.attrs_.size(), attrsSize + attrsSizeInsert); 185 EXPECT_EQ(inspectText.styles_.size(), stylesSize + stylesSizeInsert); 186 } 187 CheckTabBarAttrAndStyle(InspectTabBar & inspectTabBar,uint16_t attrsSize,uint16_t stylesSize)188 void CheckTabBarAttrAndStyle(InspectTabBar& inspectTabBar, uint16_t attrsSize, uint16_t stylesSize) 189 { 190 uint16_t attrsSizeInsert = 3; 191 uint16_t stylesSizeInsert = 0; 192 DeviceType deviceType = SystemProperties::GetDeviceType(); 193 EXPECT_EQ(inspectTabBar.attrs_["mode"], "scrollable"); 194 EXPECT_EQ(inspectTabBar.attrs_["disabled"], "false"); 195 EXPECT_EQ(inspectTabBar.attrs_["focusable"], "true"); 196 if (deviceType == DeviceType::PHONE) { 197 EXPECT_EQ(inspectTabBar.styles_["height"], "100px"); 198 stylesSizeInsert++; 199 } else if (deviceType == DeviceType::TV) { 200 EXPECT_EQ(inspectTabBar.styles_["height"], "60px"); 201 stylesSizeInsert++; 202 } 203 EXPECT_EQ(inspectTabBar.attrs_.size(), attrsSize + attrsSizeInsert); 204 EXPECT_EQ(inspectTabBar.styles_.size(), stylesSize + stylesSizeInsert); 205 } 206 CheckSwiperAttrAndStyle(InspectSwiper & inspectSwiper,uint16_t attrsSize,uint16_t stylesSize)207 void CheckSwiperAttrAndStyle(InspectSwiper& inspectSwiper, uint16_t attrsSize, uint16_t stylesSize) 208 { 209 uint16_t attrsSizeInsert = 14; 210 uint16_t stylesSizeInsert = 1; 211 DeviceType deviceType = SystemProperties::GetDeviceType(); 212 EXPECT_EQ(inspectSwiper.attrs_["index"], "0"); 213 EXPECT_EQ(inspectSwiper.attrs_["autoplay"], "false"); 214 EXPECT_EQ(inspectSwiper.attrs_["interval"], "3000"); 215 EXPECT_EQ(inspectSwiper.attrs_["indicator"], "true"); 216 EXPECT_EQ(inspectSwiper.attrs_["digital"], "false"); 217 EXPECT_EQ(inspectSwiper.attrs_["indicatormask"], "false"); 218 EXPECT_EQ(inspectSwiper.attrs_["indicatordisabled"], "false"); 219 EXPECT_EQ(inspectSwiper.attrs_["loop"], "true"); 220 EXPECT_EQ(inspectSwiper.attrs_["vertical"], "false"); 221 EXPECT_EQ(inspectSwiper.attrs_["disabled"], "false"); 222 EXPECT_EQ(inspectSwiper.attrs_["focusable"], "true"); 223 EXPECT_EQ(inspectSwiper.attrs_["cachedsize"], "-1"); 224 EXPECT_EQ(inspectSwiper.attrs_["scrolleffect"], "spring"); 225 EXPECT_EQ(inspectSwiper.attrs_["displaymode"], "stretch"); 226 if (deviceType == DeviceType::PHONE) { 227 EXPECT_EQ(inspectSwiper.styles_["indicator-selected-color"], "#ff007dff"); 228 stylesSizeInsert++; 229 } else if (deviceType == DeviceType::TV || deviceType == DeviceType::WATCH) { 230 EXPECT_EQ(inspectSwiper.styles_["indicator-selected-color"], "#ffffffff"); 231 stylesSizeInsert++; 232 } 233 EXPECT_EQ(inspectSwiper.styles_["indicator-size"], "4px"); 234 EXPECT_EQ(inspectSwiper.attrs_.size(), attrsSize + attrsSizeInsert); 235 EXPECT_EQ(inspectSwiper.styles_.size(), stylesSize + stylesSizeInsert); 236 } 237 CheckSliderAttrAndStyle(InspectSlider & inspectSlider,uint16_t attrsSize,uint16_t stylesSize)238 void CheckSliderAttrAndStyle(InspectSlider& inspectSlider, uint16_t attrsSize, uint16_t stylesSize) 239 { 240 uint16_t attrsSizeInsert = 10; 241 uint16_t stylesSizeInsert = 1; 242 uint16_t insertTwo = 2; 243 DeviceType deviceType = SystemProperties::GetDeviceType(); 244 EXPECT_EQ(inspectSlider.attrs_["min"], "0"); 245 EXPECT_EQ(inspectSlider.attrs_["max"], "100"); 246 EXPECT_EQ(inspectSlider.attrs_["step"], "1"); 247 EXPECT_EQ(inspectSlider.attrs_["value"], "0"); 248 EXPECT_EQ(inspectSlider.attrs_["type"], "continuous"); 249 EXPECT_EQ(inspectSlider.attrs_["mode"], "outset"); 250 EXPECT_EQ(inspectSlider.attrs_["showsteps"], "false"); 251 EXPECT_EQ(inspectSlider.attrs_["showtips"], "false"); 252 EXPECT_EQ(inspectSlider.attrs_["disabled"], "false"); 253 EXPECT_EQ(inspectSlider.attrs_["focusable"], "true"); 254 if (deviceType == DeviceType::PHONE) { 255 EXPECT_EQ(inspectSlider.styles_["color"], "#19000000"); 256 EXPECT_EQ(inspectSlider.styles_["selected-color"], "#ff007dff"); 257 stylesSizeInsert += insertTwo; 258 } else if (deviceType == DeviceType::TV) { 259 EXPECT_EQ(inspectSlider.styles_["color"], "#33ffffff"); 260 EXPECT_EQ(inspectSlider.styles_["selected-color"], "#ff0d9ffb"); 261 stylesSizeInsert += insertTwo; 262 } else if (deviceType == DeviceType::WATCH) { 263 EXPECT_EQ(inspectSlider.styles_["color"], "#26ffffff"); 264 EXPECT_EQ(inspectSlider.styles_["selected-color"], "#ff007dff"); 265 stylesSizeInsert += insertTwo; 266 } 267 EXPECT_EQ(inspectSlider.styles_["block-color"], "#ffffff"); 268 EXPECT_EQ(inspectSlider.attrs_.size(), attrsSize + attrsSizeInsert); 269 EXPECT_EQ(inspectSlider.styles_.size(), stylesSize + stylesSizeInsert); 270 } 271 CheckRefreshAttrAndStyle(InspectRefresh & inspectRefresh,uint16_t attrsSize,uint16_t stylesSize)272 void CheckRefreshAttrAndStyle(InspectRefresh& inspectRefresh, uint16_t attrsSize, uint16_t stylesSize) 273 { 274 uint16_t attrsSizeInsert = 5; 275 uint16_t stylesSizeInsert = 3; 276 uint16_t insertTwo = 2; 277 DeviceType deviceType = SystemProperties::GetDeviceType(); 278 EXPECT_EQ(inspectRefresh.attrs_["refreshing"], "false"); 279 EXPECT_EQ(inspectRefresh.attrs_["type"], "auto"); 280 EXPECT_EQ(inspectRefresh.attrs_["lasttime"], "false"); 281 if (deviceType == DeviceType::PHONE) { 282 EXPECT_EQ(inspectRefresh.attrs_["friction"], "42"); 283 attrsSizeInsert++; 284 } else if (deviceType == DeviceType::WATCH) { 285 EXPECT_EQ(inspectRefresh.styles_["friction"], "62"); 286 stylesSizeInsert++; 287 } 288 EXPECT_EQ(inspectRefresh.attrs_["disabled"], "false"); 289 EXPECT_EQ(inspectRefresh.attrs_["focusable"], "true"); 290 if (deviceType == DeviceType::PHONE) { 291 EXPECT_EQ(inspectRefresh.styles_["background-color"], "white"); 292 EXPECT_EQ(inspectRefresh.styles_["progress-color"], "black"); 293 stylesSizeInsert += insertTwo; 294 } else { 295 EXPECT_EQ(inspectRefresh.styles_["background-color"], "black"); 296 EXPECT_EQ(inspectRefresh.styles_["progress-color"], "white"); 297 stylesSizeInsert += insertTwo; 298 } 299 EXPECT_EQ(inspectRefresh.styles_["min-width"], "0"); 300 EXPECT_EQ(inspectRefresh.styles_["min-height"], "0"); 301 EXPECT_EQ(inspectRefresh.styles_["box-shadow"], "0"); 302 EXPECT_EQ(inspectRefresh.attrs_.size(), attrsSize + attrsSizeInsert); 303 EXPECT_EQ(inspectRefresh.styles_.size(), stylesSize + stylesSizeInsert); 304 } 305 CheckRatingAttrAndStyle(InspectRating & inspectRating,uint16_t attrsSize,uint16_t stylesSize)306 void CheckRatingAttrAndStyle(InspectRating& inspectRating, uint16_t attrsSize, uint16_t stylesSize) 307 { 308 uint16_t attrsSizeInsert = 6; 309 uint16_t stylesSizeInsert = 1; 310 uint16_t insertTwo = 2; 311 DeviceType deviceType = SystemProperties::GetDeviceType(); 312 EXPECT_EQ(inspectRating.attrs_["numstars"], "5"); 313 EXPECT_EQ(inspectRating.attrs_["rating"], "0"); 314 EXPECT_EQ(inspectRating.attrs_["stepsize"], "0.5"); 315 EXPECT_EQ(inspectRating.attrs_["indicator"], "false"); 316 EXPECT_EQ(inspectRating.attrs_["disabled"], "false"); 317 EXPECT_EQ(inspectRating.attrs_["focusable"], "true"); 318 if (deviceType == DeviceType::PHONE) { 319 EXPECT_EQ(inspectRating.styles_["width"], "120px"); 320 EXPECT_EQ(inspectRating.styles_["height"], "24px"); 321 stylesSizeInsert += insertTwo; 322 } else if (deviceType == DeviceType::TV) { 323 EXPECT_EQ(inspectRating.styles_["width"], "360px"); 324 EXPECT_EQ(inspectRating.styles_["height"], "72px"); 325 stylesSizeInsert += insertTwo; 326 } 327 EXPECT_EQ(inspectRating.styles_["rtl-flip"], "true"); 328 EXPECT_EQ(inspectRating.attrs_.size(), attrsSize + attrsSizeInsert); 329 EXPECT_EQ(inspectRating.styles_.size(), stylesSize + stylesSizeInsert); 330 } 331 CheckProgressAttrAndStyle(InspectProgress & inspectProgress,uint16_t attrsSize,uint16_t stylesSize)332 void CheckProgressAttrAndStyle(InspectProgress& inspectProgress, uint16_t attrsSize, uint16_t stylesSize) 333 { 334 uint16_t attrsSizeInsert = 5; 335 uint16_t stylesSizeInsert = 1; 336 DeviceType deviceType = SystemProperties::GetDeviceType(); 337 EXPECT_EQ(inspectProgress.attrs_["type"], "horizontal"); 338 EXPECT_EQ(inspectProgress.attrs_["focusable"], "true"); 339 EXPECT_EQ(inspectProgress.attrs_["percent"], "0"); 340 EXPECT_EQ(inspectProgress.attrs_["secondarypercent"], "0"); 341 EXPECT_EQ(inspectProgress.attrs_["clockwise"], "true"); 342 if (deviceType == DeviceType::PHONE) { 343 EXPECT_EQ(inspectProgress.styles_["color"], "#ff007dff"); 344 stylesSizeInsert++; 345 } else if (deviceType == DeviceType::TV) { 346 EXPECT_EQ(inspectProgress.styles_["color"], "#e5ffffff"); 347 stylesSizeInsert++; 348 } else if (deviceType == DeviceType::WATCH) { 349 EXPECT_EQ(inspectProgress.styles_["color"], "#ff45a5ff"); 350 stylesSizeInsert++; 351 } 352 EXPECT_EQ(inspectProgress.styles_["stroke-width"], "4px"); 353 EXPECT_EQ(inspectProgress.styles_.find("background-size"), inspectProgress.styles_.end()); 354 EXPECT_EQ(inspectProgress.styles_.find("background-repeat"), inspectProgress.styles_.end()); 355 EXPECT_EQ(inspectProgress.styles_.find("background-position"), inspectProgress.styles_.end()); 356 EXPECT_EQ(inspectProgress.attrs_.size(), attrsSize + attrsSizeInsert); 357 EXPECT_EQ(inspectProgress.styles_.size(), stylesSize + stylesSizeInsert); 358 } 359 CheckButtonAttrAndStyle(InspectButton & inspectButton,uint16_t attrsSize,uint16_t stylesSize)360 void CheckButtonAttrAndStyle(InspectButton& inspectButton, uint16_t attrsSize, uint16_t stylesSize) 361 { 362 uint16_t attrsSizeInsert = 4; 363 uint16_t stylesSizeInsert = 4; 364 uint16_t insertTwo = 2; 365 DeviceType deviceType = SystemProperties::GetDeviceType(); 366 EXPECT_EQ(inspectButton.attrs_["placement"], "end"); 367 EXPECT_EQ(inspectButton.attrs_["waiting"], "false"); 368 EXPECT_EQ(inspectButton.attrs_["disabled"], "false"); 369 EXPECT_EQ(inspectButton.attrs_["focusable"], "true"); 370 if (deviceType == DeviceType::PHONE) { 371 EXPECT_EQ(inspectButton.styles_["text-color"], "#ff007dff"); 372 EXPECT_EQ(inspectButton.styles_["font-size"], "16px"); 373 stylesSizeInsert += insertTwo; 374 } else if (deviceType == DeviceType::TV) { 375 EXPECT_EQ(inspectButton.styles_["text-color"], "#e5ffffff"); 376 EXPECT_EQ(inspectButton.styles_["font-size"], "18px"); 377 stylesSizeInsert += insertTwo; 378 } else if (deviceType == DeviceType::WATCH) { 379 EXPECT_EQ(inspectButton.styles_["text-color"], "#ff45a5ff"); 380 EXPECT_EQ(inspectButton.styles_["font-size"], "16px"); 381 stylesSizeInsert += insertTwo; 382 } 383 EXPECT_EQ(inspectButton.styles_["allow-scale"], "true"); 384 EXPECT_EQ(inspectButton.styles_["font-style"], "normal"); 385 EXPECT_EQ(inspectButton.styles_["font-weight"], "normal"); 386 EXPECT_EQ(inspectButton.styles_["font-family"], "sans-serif"); 387 EXPECT_EQ(inspectButton.attrs_.size(), attrsSize + attrsSizeInsert); 388 EXPECT_EQ(inspectButton.styles_.size(), stylesSize + stylesSizeInsert); 389 } 390 CheckDividerAttrAndStyle(InspectDivider & inspectDivider,uint16_t attrsSize,uint16_t stylesSize)391 void CheckDividerAttrAndStyle(InspectDivider& inspectDivider, uint16_t attrsSize, uint16_t stylesSize) 392 { 393 uint16_t attrsSizeInsert = 1; 394 uint16_t stylesSizeInsert = 10; 395 DeviceType deviceType = SystemProperties::GetDeviceType(); 396 EXPECT_EQ(inspectDivider.attrs_["vertical"], "false"); 397 if (deviceType == DeviceType::PHONE) { 398 EXPECT_EQ(inspectDivider.styles_["color"], "#08000000"); 399 stylesSizeInsert++; 400 } else if (deviceType == DeviceType::TV) { 401 EXPECT_EQ(inspectDivider.styles_["color"], "#33ffffff"); 402 stylesSizeInsert++; 403 } else if (deviceType == DeviceType::WATCH) { 404 EXPECT_EQ(inspectDivider.styles_["color"], "#33ffffff"); 405 stylesSizeInsert++; 406 } 407 EXPECT_EQ(inspectDivider.styles_["stroke-width"], "1"); 408 EXPECT_EQ(inspectDivider.styles_["line-cap"], "butt"); 409 EXPECT_EQ(inspectDivider.styles_["margin-left"], "0"); 410 EXPECT_EQ(inspectDivider.styles_["margin-top"], "0"); 411 EXPECT_EQ(inspectDivider.styles_["margin-right"], "0"); 412 EXPECT_EQ(inspectDivider.styles_["margin-bottom"], "0"); 413 EXPECT_EQ(inspectDivider.styles_["display"], "flex"); 414 EXPECT_EQ(inspectDivider.styles_["visibility"], "visible"); 415 EXPECT_EQ(inspectDivider.styles_["flex-grow"], "0"); 416 EXPECT_EQ(inspectDivider.styles_["flex-shrink"], "1"); 417 EXPECT_EQ(inspectDivider.attrs_.size(), attrsSize + attrsSizeInsert); 418 EXPECT_EQ(inspectDivider.styles_.size(), stylesSize + stylesSizeInsert); 419 } 420 CheckInputAttrAndStyle(InspectInput & inspectInput,uint16_t attrsSize,uint16_t stylesSize)421 void CheckInputAttrAndStyle(InspectInput& inspectInput, uint16_t attrsSize, uint16_t stylesSize) 422 { 423 uint16_t attrsSizeInsert = 6; 424 uint16_t stylesSizeInsert = 3; 425 uint16_t insertThree = 3; 426 DeviceType deviceType = SystemProperties::GetDeviceType(); 427 EXPECT_EQ(inspectInput.attrs_["type"], "text"); 428 EXPECT_EQ(inspectInput.attrs_["checked"], "false"); 429 EXPECT_EQ(inspectInput.attrs_["enterkeytype"], "default"); 430 EXPECT_EQ(inspectInput.attrs_["showcounter"], "false"); 431 EXPECT_EQ(inspectInput.attrs_["disabled"], "false"); 432 EXPECT_EQ(inspectInput.attrs_["focusable"], "true"); 433 if (deviceType == DeviceType::PHONE) { 434 EXPECT_EQ(inspectInput.styles_["color"], "#e6000000"); 435 EXPECT_EQ(inspectInput.styles_["font-size"], "16px"); 436 EXPECT_EQ(inspectInput.styles_["placeholder-color"], "#99000000"); 437 stylesSizeInsert += insertThree; 438 } else if (deviceType == DeviceType::TV) { 439 EXPECT_EQ(inspectInput.styles_["color"], "#e6ffffff"); 440 EXPECT_EQ(inspectInput.styles_["font-size"], "18px"); 441 EXPECT_EQ(inspectInput.styles_["placeholder-color"], "#99ffffff"); 442 stylesSizeInsert += insertThree; 443 } 444 EXPECT_EQ(inspectInput.styles_["allow-scale"], "true"); 445 EXPECT_EQ(inspectInput.styles_["font-weight"], "normal"); 446 EXPECT_EQ(inspectInput.styles_["font-family"], "sans-serif"); 447 EXPECT_EQ(inspectInput.attrs_.size(), attrsSize + attrsSizeInsert); 448 EXPECT_EQ(inspectInput.styles_.size(), stylesSize + stylesSizeInsert); 449 } 450 CheckLabelAttrAndStyle(InspectLabel & inspectLabel,uint16_t attrsSize,uint16_t stylesSize)451 void CheckLabelAttrAndStyle(InspectLabel& inspectLabel, uint16_t attrsSize, uint16_t stylesSize) 452 { 453 uint16_t attrsSizeInsert = 2; 454 uint16_t stylesSizeInsert = 11; 455 DeviceType deviceType = SystemProperties::GetDeviceType(); 456 EXPECT_EQ(inspectLabel.attrs_["disabled"], "false"); 457 EXPECT_EQ(inspectLabel.attrs_["focusable"], "false"); 458 if (deviceType == DeviceType::PHONE) { 459 EXPECT_EQ(inspectLabel.styles_["color"], "#e5000000"); 460 stylesSizeInsert++; 461 } else if (deviceType == DeviceType::TV) { 462 EXPECT_EQ(inspectLabel.styles_["color"], "#e5ffffff"); 463 stylesSizeInsert++; 464 } else if (deviceType == DeviceType::WATCH) { 465 EXPECT_EQ(inspectLabel.styles_["color"], "#ffffffff"); 466 stylesSizeInsert++; 467 } 468 EXPECT_EQ(inspectLabel.styles_["font-size"], "30px"); 469 EXPECT_EQ(inspectLabel.styles_["allow-scale"], "true"); 470 EXPECT_EQ(inspectLabel.styles_["letter-spacing"], "0px"); 471 EXPECT_EQ(inspectLabel.styles_["font-style"], "normal"); 472 EXPECT_EQ(inspectLabel.styles_["font-weight"], "normal"); 473 EXPECT_EQ(inspectLabel.styles_["text-decoration"], "none"); 474 EXPECT_EQ(inspectLabel.styles_["text-align"], "start"); 475 EXPECT_EQ(inspectLabel.styles_["line-height"], "0px"); 476 EXPECT_EQ(inspectLabel.styles_["text-overflow"], "clip"); 477 EXPECT_EQ(inspectLabel.styles_["font-family"], "sans-serif"); 478 EXPECT_EQ(inspectLabel.styles_["font-size-step"], "1px"); 479 EXPECT_EQ(inspectLabel.attrs_.size(), attrsSize + attrsSizeInsert); 480 EXPECT_EQ(inspectLabel.styles_.size(), stylesSize + stylesSizeInsert); 481 } 482 CheckMarqueeAttrAndStyle(InspectMarquee & inspectMarquee,uint16_t attrsSize,uint16_t stylesSize)483 void CheckMarqueeAttrAndStyle(InspectMarquee& inspectMarquee, uint16_t attrsSize, uint16_t stylesSize) 484 { 485 uint16_t attrsSizeInsert = 5; 486 uint16_t stylesSizeInsert = 4; 487 DeviceType deviceType = SystemProperties::GetDeviceType(); 488 EXPECT_EQ(inspectMarquee.attrs_["scrollamount"], "6"); 489 EXPECT_EQ(inspectMarquee.attrs_["loop"], "-1"); 490 EXPECT_EQ(inspectMarquee.attrs_["direction"], "left"); 491 EXPECT_EQ(inspectMarquee.attrs_["disabled"], "false"); 492 EXPECT_EQ(inspectMarquee.attrs_["focusable"], "false"); 493 if (deviceType == DeviceType::PHONE) { 494 EXPECT_EQ(inspectMarquee.styles_["color"], "#e5000000"); 495 stylesSizeInsert++; 496 } else if (deviceType == DeviceType::TV) { 497 EXPECT_EQ(inspectMarquee.styles_["color"], "#e5ffffff"); 498 stylesSizeInsert++; 499 } else if (deviceType == DeviceType::WATCH) { 500 EXPECT_EQ(inspectMarquee.styles_["color"], "#ffffffff"); 501 stylesSizeInsert++; 502 } 503 EXPECT_EQ(inspectMarquee.styles_["font-size"], "37.5"); 504 EXPECT_EQ(inspectMarquee.styles_["allow-scale"], "true"); 505 EXPECT_EQ(inspectMarquee.styles_["font-weight"], "normal"); 506 EXPECT_EQ(inspectMarquee.styles_["font-family"], "sans-serif"); 507 EXPECT_EQ(inspectMarquee.attrs_.size(), attrsSize + attrsSizeInsert); 508 EXPECT_EQ(inspectMarquee.styles_.size(), stylesSize + stylesSizeInsert); 509 } 510 }; 511 512 /** 513 * @tc.name: InspectBadgeTest001 514 * @tc.desc: InspectBadge::InspectBadge 515 * @tc.type: FUNC 516 */ 517 HWTEST_F(JSInspectorTest, InspectBadgeTest001, TestSize.Level1) 518 { 519 NodeId nodeId = -1; 520 std::string tag = "tagTest"; 521 InspectBadge inspectBadge(nodeId, tag); 522 EXPECT_EQ(inspectBadge.nodeId_, nodeId); 523 EXPECT_EQ(inspectBadge.tag_, tag); 524 } 525 526 /** 527 * @tc.name: InspectBadgeTest002 528 * @tc.desc: InspectBadge::PackAttrAndStyle 529 * @tc.type: FUNC 530 */ 531 HWTEST_F(JSInspectorTest, InspectBadgeTest002, TestSize.Level1) 532 { 533 NodeId nodeId = -1; 534 std::string tag = "tagTest"; 535 InspectBadge inspectBadge(nodeId, tag); 536 auto size = inspectBadge.attrs_.size(); 537 uint16_t sizeInsert = 7; 538 inspectBadge.PackAttrAndStyle(); 539 EXPECT_EQ(inspectBadge.attrs_.size(), size + sizeInsert); 540 EXPECT_EQ(inspectBadge.attrs_["placement"], "rightTop"); 541 EXPECT_EQ(inspectBadge.attrs_["count"], "0"); 542 EXPECT_EQ(inspectBadge.attrs_["visible"], "false"); 543 EXPECT_EQ(inspectBadge.attrs_["maxcount"], "99"); 544 EXPECT_EQ(inspectBadge.attrs_["config"], "BadgeConfig"); 545 EXPECT_EQ(inspectBadge.attrs_["disabled"], "false"); 546 EXPECT_EQ(inspectBadge.attrs_["focusable"], "false"); 547 } 548 549 /** 550 * @tc.name: InspectButtonTest001 551 * @tc.desc: InspectButton::InspectButton 552 * @tc.type: FUNC 553 */ 554 HWTEST_F(JSInspectorTest, InspectButtonTest001, TestSize.Level1) 555 { 556 NodeId nodeId = -1; 557 std::string tag = "tagTest"; 558 InspectButton inspectButton(nodeId, tag); 559 EXPECT_EQ(inspectButton.nodeId_, nodeId); 560 EXPECT_EQ(inspectButton.tag_, tag); 561 } 562 563 /** 564 * @tc.name: InspectButtonTest002 565 * @tc.desc: InspectButton::PackAttrAndStyle-PHONE 566 * @tc.type: FUNC 567 */ 568 HWTEST_F(JSInspectorTest, InspectButtonTest002, TestSize.Level1) 569 { 570 NodeId nodeId = -1; 571 std::string tag = "tagTest"; 572 InspectButton inspectButton(nodeId, tag); 573 auto attrsSize = inspectButton.attrs_.size(); 574 auto stylesSize = inspectButton.styles_.size(); 575 576 DeviceType deviceType = SystemProperties::GetDeviceType(); 577 SystemProperties::SetDeviceType(DeviceType::PHONE); 578 inspectButton.PackAttrAndStyle(); 579 CheckButtonAttrAndStyle(inspectButton, attrsSize, stylesSize); 580 SystemProperties::SetDeviceType(deviceType); 581 } 582 583 /** 584 * @tc.name: InspectButtonTest003 585 * @tc.desc: InspectButton::PackAttrAndStyle-TV 586 * @tc.type: FUNC 587 */ 588 HWTEST_F(JSInspectorTest, InspectButtonTest003, TestSize.Level1) 589 { 590 NodeId nodeId = -1; 591 std::string tag = "tagTest"; 592 InspectButton inspectButton(nodeId, tag); 593 auto attrsSize = inspectButton.attrs_.size(); 594 auto stylesSize = inspectButton.styles_.size(); 595 596 DeviceType deviceType = SystemProperties::GetDeviceType(); 597 SystemProperties::SetDeviceType(DeviceType::TV); 598 inspectButton.PackAttrAndStyle(); 599 CheckButtonAttrAndStyle(inspectButton, attrsSize, stylesSize); 600 SystemProperties::SetDeviceType(deviceType); 601 } 602 603 /** 604 * @tc.name: InspectButtonTest004 605 * @tc.desc: InspectButton::PackAttrAndStyle-WATCH 606 * @tc.type: FUNC 607 */ 608 HWTEST_F(JSInspectorTest, InspectButtonTest004, TestSize.Level1) 609 { 610 NodeId nodeId = -1; 611 std::string tag = "tagTest"; 612 InspectButton inspectButton(nodeId, tag); 613 auto attrsSize = inspectButton.attrs_.size(); 614 auto stylesSize = inspectButton.styles_.size(); 615 616 DeviceType deviceType = SystemProperties::GetDeviceType(); 617 SystemProperties::SetDeviceType(DeviceType::WATCH); 618 inspectButton.PackAttrAndStyle(); 619 CheckButtonAttrAndStyle(inspectButton, attrsSize, stylesSize); 620 SystemProperties::SetDeviceType(deviceType); 621 } 622 623 /** 624 * @tc.name: InspectButtonTest005 625 * @tc.desc: InspectButton::PackAttrAndStyle-CAR 626 * @tc.type: FUNC 627 */ 628 HWTEST_F(JSInspectorTest, InspectButtonTest005, TestSize.Level1) 629 { 630 NodeId nodeId = -1; 631 std::string tag = "tagTest"; 632 InspectButton inspectButton(nodeId, tag); 633 auto attrsSize = inspectButton.attrs_.size(); 634 auto stylesSize = inspectButton.styles_.size(); 635 636 DeviceType deviceType = SystemProperties::GetDeviceType(); 637 SystemProperties::SetDeviceType(DeviceType::CAR); 638 inspectButton.PackAttrAndStyle(); 639 CheckButtonAttrAndStyle(inspectButton, attrsSize, stylesSize); 640 SystemProperties::SetDeviceType(deviceType); 641 } 642 643 /** 644 * @tc.name: InspectButtonTest006 645 * @tc.desc: InspectButton::PackAttrAndStyle-TABLET 646 * @tc.type: FUNC 647 */ 648 HWTEST_F(JSInspectorTest, InspectButtonTest006, TestSize.Level1) 649 { 650 NodeId nodeId = -1; 651 std::string tag = "tagTest"; 652 InspectButton inspectButton(nodeId, tag); 653 auto attrsSize = inspectButton.attrs_.size(); 654 auto stylesSize = inspectButton.styles_.size(); 655 656 DeviceType deviceType = SystemProperties::GetDeviceType(); 657 SystemProperties::SetDeviceType(DeviceType::TABLET); 658 inspectButton.PackAttrAndStyle(); 659 CheckButtonAttrAndStyle(inspectButton, attrsSize, stylesSize); 660 SystemProperties::SetDeviceType(deviceType); 661 } 662 663 /** 664 * @tc.name: InspectButtonTest007 665 * @tc.desc: InspectButton::PackAttrAndStyle-UNKNOWN 666 * @tc.type: FUNC 667 */ 668 HWTEST_F(JSInspectorTest, InspectButtonTest007, TestSize.Level1) 669 { 670 NodeId nodeId = -1; 671 std::string tag = "tagTest"; 672 InspectButton inspectButton(nodeId, tag); 673 auto attrsSize = inspectButton.attrs_.size(); 674 auto stylesSize = inspectButton.styles_.size(); 675 676 DeviceType deviceType = SystemProperties::GetDeviceType(); 677 SystemProperties::SetDeviceType(DeviceType::UNKNOWN); 678 inspectButton.PackAttrAndStyle(); 679 CheckButtonAttrAndStyle(inspectButton, attrsSize, stylesSize); 680 SystemProperties::SetDeviceType(deviceType); 681 } 682 683 /** 684 * @tc.name: InspectCameraTest001 685 * @tc.desc: InspectCamera::InspectCamera 686 * @tc.type: FUNC 687 */ 688 HWTEST_F(JSInspectorTest, InspectCameraTest001, TestSize.Level1) 689 { 690 NodeId nodeId = -1; 691 std::string tag = "tagTest"; 692 InspectCamera inspectCamera(nodeId, tag); 693 EXPECT_EQ(inspectCamera.nodeId_, nodeId); 694 EXPECT_EQ(inspectCamera.tag_, tag); 695 } 696 697 /** 698 * @tc.name: InspectCameraTest002 699 * @tc.desc: InspectCamera::PackAttrAndStyle 700 * @tc.type: FUNC 701 */ 702 HWTEST_F(JSInspectorTest, InspectCameraTest002, TestSize.Level1) 703 { 704 NodeId nodeId = -1; 705 std::string tag = "tagTest"; 706 InspectCamera inspectCamera(nodeId, tag); 707 auto size = inspectCamera.attrs_.size(); 708 uint16_t sizeInsert = 2; 709 inspectCamera.PackAttrAndStyle(); 710 EXPECT_EQ(inspectCamera.attrs_.size(), size + sizeInsert); 711 EXPECT_EQ(inspectCamera.attrs_["flash"], "off"); 712 EXPECT_EQ(inspectCamera.attrs_["deviceposition"], "back"); 713 } 714 715 /** 716 * @tc.name: InspectCanvasTest001 717 * @tc.desc: InspectCanvas::InspectCanvas 718 * @tc.type: FUNC 719 */ 720 HWTEST_F(JSInspectorTest, InspectCanvasTest001, TestSize.Level1) 721 { 722 NodeId nodeId = -1; 723 std::string tag = "tagTest"; 724 InspectCanvas inspectCanvas(nodeId, tag); 725 EXPECT_EQ(inspectCanvas.nodeId_, nodeId); 726 EXPECT_EQ(inspectCanvas.tag_, tag); 727 } 728 729 /** 730 * @tc.name: InspectCanvasTest002 731 * @tc.desc: InspectCanvas::PackAttrAndStyle 732 * @tc.type: FUNC 733 */ 734 HWTEST_F(JSInspectorTest, InspectCanvasTest002, TestSize.Level1) 735 { 736 NodeId nodeId = -1; 737 std::string tag = "tagTest"; 738 InspectCanvas inspectCanvas(nodeId, tag); 739 auto size = inspectCanvas.attrs_.size(); 740 uint16_t sizeInsert = 2; 741 inspectCanvas.PackAttrAndStyle(); 742 EXPECT_EQ(inspectCanvas.attrs_.size(), size + sizeInsert); 743 EXPECT_EQ(inspectCanvas.attrs_["disabled"], "false"); 744 EXPECT_EQ(inspectCanvas.attrs_["focusable"], "false"); 745 } 746 747 /** 748 * @tc.name: InspectChartTest001 749 * @tc.desc: InspectChart::InspectChart 750 * @tc.type: FUNC 751 */ 752 HWTEST_F(JSInspectorTest, InspectChartTest001, TestSize.Level1) 753 { 754 NodeId nodeId = -1; 755 std::string tag = "tagTest"; 756 InspectChart inspectChart(nodeId, tag); 757 EXPECT_EQ(inspectChart.nodeId_, nodeId); 758 EXPECT_EQ(inspectChart.tag_, tag); 759 } 760 761 /** 762 * @tc.name: InspectChartTest002 763 * @tc.desc: InspectChart::PackAttrAndStyle 764 * @tc.type: FUNC 765 */ 766 HWTEST_F(JSInspectorTest, InspectChartTest002, TestSize.Level1) 767 { 768 NodeId nodeId = -1; 769 std::string tag = "tagTest"; 770 InspectChart inspectChart(nodeId, tag); 771 auto attrsSize = inspectChart.attrs_.size(); 772 auto stylesSize = inspectChart.styles_.size(); 773 uint16_t attrsSizeInsert = 19; 774 uint16_t stylesSizeInsert = 3; 775 inspectChart.PackAttrAndStyle(); 776 EXPECT_EQ(inspectChart.attrs_.size(), attrsSize + attrsSizeInsert); 777 EXPECT_EQ(inspectChart.styles_.size(), stylesSize + stylesSizeInsert); 778 EXPECT_EQ(inspectChart.attrs_["type"], "line"); 779 EXPECT_EQ(inspectChart.attrs_["effects"], "true"); 780 EXPECT_EQ(inspectChart.attrs_["disabled"], "false"); 781 EXPECT_EQ(inspectChart.attrs_["focusable"], "false"); 782 // insert makes sure that the second insert is invalid 783 EXPECT_EQ(inspectChart.attrs_["strokeColor"], "#ff6384"); 784 EXPECT_EQ(inspectChart.attrs_["fillColor"], "#ff6384"); 785 EXPECT_EQ(inspectChart.attrs_["gradient"], "false"); 786 EXPECT_EQ(inspectChart.attrs_["min"], "0"); 787 EXPECT_EQ(inspectChart.attrs_["max"], "100"); 788 EXPECT_EQ(inspectChart.attrs_["axisTick"], "10"); 789 EXPECT_EQ(inspectChart.attrs_["display"], "false"); 790 EXPECT_EQ(inspectChart.attrs_["color"], "#c0c0c0"); 791 EXPECT_EQ(inspectChart.attrs_["width"], "1px"); 792 EXPECT_EQ(inspectChart.attrs_["smooth"], "false"); 793 EXPECT_EQ(inspectChart.attrs_["shape"], "circle"); 794 EXPECT_EQ(inspectChart.attrs_["size"], "5px"); 795 EXPECT_EQ(inspectChart.attrs_["strokeWidth"], "1px"); 796 EXPECT_EQ(inspectChart.attrs_["margin"], "1"); 797 EXPECT_EQ(inspectChart.attrs_["percent"], "0"); 798 EXPECT_EQ(inspectChart.styles_["stroke-width"], "32px"); 799 EXPECT_EQ(inspectChart.styles_["start-angle"], "240"); 800 EXPECT_EQ(inspectChart.styles_["total-angle"], "240"); 801 } 802 803 /** 804 * @tc.name: InspectDialogTest001 805 * @tc.desc: InspectDialog::InspectDialog 806 * @tc.type: FUNC 807 */ 808 HWTEST_F(JSInspectorTest, InspectDialogTest001, TestSize.Level1) 809 { 810 NodeId nodeId = -1; 811 std::string tag = "tagTest"; 812 InspectDialog inspectDialog(nodeId, tag); 813 EXPECT_EQ(inspectDialog.nodeId_, nodeId); 814 EXPECT_EQ(inspectDialog.tag_, tag); 815 } 816 817 /** 818 * @tc.name: InspectDialogTest002 819 * @tc.desc: InspectDialog::PackAttrAndStyle 820 * @tc.type: FUNC 821 */ 822 HWTEST_F(JSInspectorTest, InspectDialogTest002, TestSize.Level1) 823 { 824 NodeId nodeId = -1; 825 std::string tag = "tagTest"; 826 InspectDialog inspectDialog(nodeId, tag); 827 auto attrsSize = inspectDialog.attrs_.size(); 828 uint16_t attrsSizeInsert = 2; 829 uint16_t stylesSizeInsert = 4; 830 831 // SystemProperties::SetDeviceType(DeviceType::PHONE); 832 inspectDialog.PackAttrAndStyle(); 833 EXPECT_EQ(inspectDialog.attrs_.size(), attrsSize + attrsSizeInsert); 834 EXPECT_EQ(inspectDialog.styles_.size(), stylesSizeInsert); 835 EXPECT_EQ(inspectDialog.attrs_["disabled"], "false"); 836 EXPECT_EQ(inspectDialog.attrs_["dragable"], "false"); 837 EXPECT_EQ(inspectDialog.styles_["margin-left"], "0"); 838 EXPECT_EQ(inspectDialog.styles_["margin-top"], "0"); 839 EXPECT_EQ(inspectDialog.styles_["margin-right"], "0"); 840 EXPECT_EQ(inspectDialog.styles_["margin-bottom"], "0"); 841 } 842 843 /** 844 * @tc.name: InspectDivTest001 845 * @tc.desc: InspectDiv::InspectDiv 846 * @tc.type: FUNC 847 */ 848 HWTEST_F(JSInspectorTest, InspectDivTest001, TestSize.Level1) 849 { 850 NodeId nodeId = -1; 851 std::string tag = "tagTest"; 852 InspectDiv inspectDiv(nodeId, tag); 853 EXPECT_EQ(inspectDiv.nodeId_, nodeId); 854 EXPECT_EQ(inspectDiv.tag_, tag); 855 } 856 857 /** 858 * @tc.name: InspectDivTest002 859 * @tc.desc: InspectDiv::PackAttrAndStyle 860 * @tc.type: FUNC 861 */ 862 HWTEST_F(JSInspectorTest, InspectDivTest002, TestSize.Level1) 863 { 864 NodeId nodeId = -1; 865 std::string tag = "tagTest"; 866 InspectDiv inspectDiv(nodeId, tag); 867 auto attrsSize = inspectDiv.attrs_.size(); 868 auto stylesSize = inspectDiv.styles_.size(); 869 uint16_t attrsSizeInsert = 2; 870 uint16_t stylesSizeInsert = 10; 871 872 inspectDiv.PackAttrAndStyle(); 873 EXPECT_EQ(inspectDiv.attrs_.size(), attrsSize + attrsSizeInsert); 874 EXPECT_EQ(inspectDiv.attrs_["disabled"], "false"); 875 EXPECT_EQ(inspectDiv.attrs_["focusable"], "true"); 876 EXPECT_EQ(inspectDiv.styles_.size(), stylesSize + stylesSizeInsert); 877 EXPECT_EQ(inspectDiv.styles_["flex-direction"], "row"); 878 EXPECT_EQ(inspectDiv.styles_["flex-wrap"], "nowrap"); 879 EXPECT_EQ(inspectDiv.styles_["justify-content"], "flex-start"); 880 EXPECT_EQ(inspectDiv.styles_["align-items"], "stretch"); 881 EXPECT_EQ(inspectDiv.styles_["align-content"], "flex-start"); 882 EXPECT_EQ(inspectDiv.styles_["display"], "flex"); 883 EXPECT_EQ(inspectDiv.styles_["grid-template-columns"], "1"); 884 EXPECT_EQ(inspectDiv.styles_["grid-template-rows"], "1"); 885 EXPECT_EQ(inspectDiv.styles_["grid-columns-gap"], "0"); 886 EXPECT_EQ(inspectDiv.styles_["grid-rows-gap"], "0"); 887 } 888 889 /** 890 * @tc.name: InspectDividerTest001 891 * @tc.desc: InspectDivider::InspectDivider 892 * @tc.type: FUNC 893 */ 894 HWTEST_F(JSInspectorTest, InspectDividerTest001, TestSize.Level1) 895 { 896 NodeId nodeId = -1; 897 std::string tag = "tagTest"; 898 InspectDivider inspectDivider(nodeId, tag); 899 EXPECT_EQ(inspectDivider.nodeId_, nodeId); 900 EXPECT_EQ(inspectDivider.tag_, tag); 901 } 902 903 /** 904 * @tc.name: InspectDividerTest002 905 * @tc.desc: InspectDivider::PackAttrAndStyle-PHONE 906 * @tc.type: FUNC 907 */ 908 HWTEST_F(JSInspectorTest, InspectDividerTest002, TestSize.Level1) 909 { 910 NodeId nodeId = -1; 911 std::string tag = "tagTest"; 912 InspectDivider inspectDivider(nodeId, tag); 913 auto attrsSize = inspectDivider.attrs_.size(); 914 auto stylesSize = inspectDivider.styles_.size(); 915 916 DeviceType deviceType = SystemProperties::GetDeviceType(); 917 SystemProperties::SetDeviceType(DeviceType::PHONE); 918 inspectDivider.PackAttrAndStyle(); 919 CheckDividerAttrAndStyle(inspectDivider, attrsSize, stylesSize); 920 SystemProperties::SetDeviceType(deviceType); 921 } 922 923 /** 924 * @tc.name: InspectDividerTest003 925 * @tc.desc: InspectDivider::PackAttrAndStyle-TV 926 * @tc.type: FUNC 927 */ 928 HWTEST_F(JSInspectorTest, InspectDividerTest003, TestSize.Level1) 929 { 930 NodeId nodeId = -1; 931 std::string tag = "tagTest"; 932 InspectDivider inspectDivider(nodeId, tag); 933 auto attrsSize = inspectDivider.attrs_.size(); 934 auto stylesSize = inspectDivider.styles_.size(); 935 936 DeviceType deviceType = SystemProperties::GetDeviceType(); 937 SystemProperties::SetDeviceType(DeviceType::TV); 938 inspectDivider.PackAttrAndStyle(); 939 CheckDividerAttrAndStyle(inspectDivider, attrsSize, stylesSize); 940 SystemProperties::SetDeviceType(deviceType); 941 } 942 943 /** 944 * @tc.name: InspectDividerTest004 945 * @tc.desc: InspectDivider::PackAttrAndStyle-WATCH 946 * @tc.type: FUNC 947 */ 948 HWTEST_F(JSInspectorTest, InspectDividerTest004, TestSize.Level1) 949 { 950 NodeId nodeId = -1; 951 std::string tag = "tagTest"; 952 InspectDivider inspectDivider(nodeId, tag); 953 auto attrsSize = inspectDivider.attrs_.size(); 954 auto stylesSize = inspectDivider.styles_.size(); 955 956 DeviceType deviceType = SystemProperties::GetDeviceType(); 957 SystemProperties::SetDeviceType(DeviceType::WATCH); 958 inspectDivider.PackAttrAndStyle(); 959 CheckDividerAttrAndStyle(inspectDivider, attrsSize, stylesSize); 960 SystemProperties::SetDeviceType(deviceType); 961 } 962 963 /** 964 * @tc.name: InspectDividerTest005 965 * @tc.desc: InspectDivider::PackAttrAndStyle-CAR 966 * @tc.type: FUNC 967 */ 968 HWTEST_F(JSInspectorTest, InspectDividerTest005, TestSize.Level1) 969 { 970 NodeId nodeId = -1; 971 std::string tag = "tagTest"; 972 InspectDivider inspectDivider(nodeId, tag); 973 auto attrsSize = inspectDivider.attrs_.size(); 974 auto stylesSize = inspectDivider.styles_.size(); 975 976 DeviceType deviceType = SystemProperties::GetDeviceType(); 977 SystemProperties::SetDeviceType(DeviceType::CAR); 978 inspectDivider.PackAttrAndStyle(); 979 CheckDividerAttrAndStyle(inspectDivider, attrsSize, stylesSize); 980 SystemProperties::SetDeviceType(deviceType); 981 } 982 983 /** 984 * @tc.name: InspectDividerTest006 985 * @tc.desc: InspectDivider::PackAttrAndStyle-TABLET 986 * @tc.type: FUNC 987 */ 988 HWTEST_F(JSInspectorTest, InspectDividerTest006, TestSize.Level1) 989 { 990 NodeId nodeId = -1; 991 std::string tag = "tagTest"; 992 InspectDivider inspectDivider(nodeId, tag); 993 auto attrsSize = inspectDivider.attrs_.size(); 994 auto stylesSize = inspectDivider.styles_.size(); 995 996 DeviceType deviceType = SystemProperties::GetDeviceType(); 997 SystemProperties::SetDeviceType(DeviceType::TABLET); 998 inspectDivider.PackAttrAndStyle(); 999 CheckDividerAttrAndStyle(inspectDivider, attrsSize, stylesSize); 1000 SystemProperties::SetDeviceType(deviceType); 1001 } 1002 1003 /** 1004 * @tc.name: InspectDividerTest007 1005 * @tc.desc: InspectDivider::PackAttrAndStyle-UNKNOWN 1006 * @tc.type: FUNC 1007 */ 1008 HWTEST_F(JSInspectorTest, InspectDividerTest007, TestSize.Level1) 1009 { 1010 NodeId nodeId = -1; 1011 std::string tag = "tagTest"; 1012 InspectDivider inspectDivider(nodeId, tag); 1013 auto attrsSize = inspectDivider.attrs_.size(); 1014 auto stylesSize = inspectDivider.styles_.size(); 1015 1016 DeviceType deviceType = SystemProperties::GetDeviceType(); 1017 SystemProperties::SetDeviceType(DeviceType::UNKNOWN); 1018 inspectDivider.PackAttrAndStyle(); 1019 CheckDividerAttrAndStyle(inspectDivider, attrsSize, stylesSize); 1020 SystemProperties::SetDeviceType(deviceType); 1021 } 1022 1023 /** 1024 * @tc.name: InspectFormTest001 1025 * @tc.desc: InspectForm::InspectForm 1026 * @tc.type: FUNC 1027 */ 1028 HWTEST_F(JSInspectorTest, InspectFormTest001, TestSize.Level1) 1029 { 1030 NodeId nodeId = -1; 1031 std::string tag = "tagTest"; 1032 InspectForm inspectForm(nodeId, tag); 1033 EXPECT_EQ(inspectForm.nodeId_, nodeId); 1034 EXPECT_EQ(inspectForm.tag_, tag); 1035 } 1036 1037 /** 1038 * @tc.name: InspectFormTest002 1039 * @tc.desc: InspectForm::PackAttrAndStyle 1040 * @tc.type: FUNC 1041 */ 1042 HWTEST_F(JSInspectorTest, InspectFormTest002, TestSize.Level1) 1043 { 1044 NodeId nodeId = -1; 1045 std::string tag = "tagTest"; 1046 InspectForm inspectForm(nodeId, tag); 1047 auto attrsSize = inspectForm.attrs_.size(); 1048 auto stylesSize = inspectForm.styles_.size(); 1049 inspectForm.PackAttrAndStyle(); 1050 EXPECT_EQ(inspectForm.attrs_.size(), attrsSize); 1051 EXPECT_EQ(inspectForm.styles_.size(), stylesSize); 1052 } 1053 1054 /** 1055 * @tc.name: InspectGridColumnTest001 1056 * @tc.desc: InspectGridColumn::InspectGridColumn 1057 * @tc.type: FUNC 1058 */ 1059 HWTEST_F(JSInspectorTest, InspectGridColumnTest001, TestSize.Level1) 1060 { 1061 NodeId nodeId = -1; 1062 std::string tag = "tagTest"; 1063 InspectGridColumn inspectGridColumn(nodeId, tag); 1064 EXPECT_EQ(inspectGridColumn.nodeId_, nodeId); 1065 EXPECT_EQ(inspectGridColumn.tag_, tag); 1066 } 1067 1068 /** 1069 * @tc.name: InspectGridColumnTest002 1070 * @tc.desc: InspectGridColumn::PackAttrAndStyle 1071 * @tc.type: FUNC 1072 */ 1073 HWTEST_F(JSInspectorTest, InspectGridColumnTest002, TestSize.Level1) 1074 { 1075 NodeId nodeId = -1; 1076 std::string tag = "tagTest"; 1077 InspectGridColumn inspectGridColumn(nodeId, tag); 1078 auto attrsSize = inspectGridColumn.attrs_.size(); 1079 auto stylesSize = inspectGridColumn.styles_.size(); 1080 uint16_t attrsSizeInsert = 4; 1081 uint16_t stylesSizeInsert = 9; 1082 1083 inspectGridColumn.PackAttrAndStyle(); 1084 EXPECT_EQ(inspectGridColumn.attrs_.size(), attrsSize + attrsSizeInsert); 1085 EXPECT_EQ(inspectGridColumn.attrs_["span"], "1"); 1086 EXPECT_EQ(inspectGridColumn.attrs_["offset"], "0"); 1087 EXPECT_EQ(inspectGridColumn.attrs_["disabled"], "false"); 1088 EXPECT_EQ(inspectGridColumn.attrs_["focusable"], "false"); 1089 EXPECT_EQ(inspectGridColumn.styles_.size(), stylesSize + stylesSizeInsert); 1090 EXPECT_EQ(inspectGridColumn.styles_["flex-direction"], "row"); 1091 EXPECT_EQ(inspectGridColumn.styles_["flex-wrap"], "nowrap"); 1092 EXPECT_EQ(inspectGridColumn.styles_["justify-content"], "flex-start"); 1093 EXPECT_EQ(inspectGridColumn.styles_["align-items"], "stretch"); 1094 EXPECT_EQ(inspectGridColumn.styles_["align-content"], "flex-start"); 1095 EXPECT_EQ(inspectGridColumn.styles_["grid-template-columns"], "1"); 1096 EXPECT_EQ(inspectGridColumn.styles_["grid-template-rows"], "1"); 1097 EXPECT_EQ(inspectGridColumn.styles_["grid-columns-gap"], "0"); 1098 EXPECT_EQ(inspectGridColumn.styles_["grid-rows-gap"], "0"); 1099 EXPECT_EQ(inspectGridColumn.styles_.find("margin-left"), inspectGridColumn.styles_.end()); 1100 EXPECT_EQ(inspectGridColumn.styles_.find("margin-top"), inspectGridColumn.styles_.end()); 1101 EXPECT_EQ(inspectGridColumn.styles_.find("margin-right"), inspectGridColumn.styles_.end()); 1102 EXPECT_EQ(inspectGridColumn.styles_.find("margin-bottom"), inspectGridColumn.styles_.end()); 1103 EXPECT_EQ(inspectGridColumn.styles_.find("margin-start"), inspectGridColumn.styles_.end()); 1104 EXPECT_EQ(inspectGridColumn.styles_.find("margin-end"), inspectGridColumn.styles_.end()); 1105 EXPECT_EQ(inspectGridColumn.styles_.find("flex-grow"), inspectGridColumn.styles_.end()); 1106 EXPECT_EQ(inspectGridColumn.styles_.find("flex-shrink"), inspectGridColumn.styles_.end()); 1107 EXPECT_EQ(inspectGridColumn.styles_.find("position"), inspectGridColumn.styles_.end()); 1108 } 1109 1110 /** 1111 * @tc.name: InspectGridContainerTest001 1112 * @tc.desc: InspectGridContainer::InspectGridContainer 1113 * @tc.type: FUNC 1114 */ 1115 HWTEST_F(JSInspectorTest, InspectGridContainerTest001, TestSize.Level1) 1116 { 1117 NodeId nodeId = -1; 1118 std::string tag = "tagTest"; 1119 InspectGridContainer inspectGridContainer(nodeId, tag); 1120 EXPECT_EQ(inspectGridContainer.nodeId_, nodeId); 1121 EXPECT_EQ(inspectGridContainer.tag_, tag); 1122 } 1123 1124 /** 1125 * @tc.name: InspectGridContainerTest002 1126 * @tc.desc: InspectGridContainer::PackAttrAndStyle 1127 * @tc.type: FUNC 1128 */ 1129 HWTEST_F(JSInspectorTest, InspectGridContainerTest002, TestSize.Level1) 1130 { 1131 NodeId nodeId = -1; 1132 std::string tag = "tagTest"; 1133 InspectGridContainer inspectGridContainer(nodeId, tag); 1134 auto attrsSize = inspectGridContainer.attrs_.size(); 1135 auto stylesSize = inspectGridContainer.styles_.size(); 1136 uint16_t attrsSizeInsert = 5; 1137 uint16_t stylesSizeInsert = 3; 1138 1139 inspectGridContainer.PackAttrAndStyle(); 1140 EXPECT_EQ(inspectGridContainer.attrs_.size(), attrsSize + attrsSizeInsert); 1141 EXPECT_EQ(inspectGridContainer.attrs_["columns"], "auto"); 1142 EXPECT_EQ(inspectGridContainer.attrs_["sizetype"], "auto"); 1143 EXPECT_EQ(inspectGridContainer.attrs_["gutter"], "24px"); 1144 EXPECT_EQ(inspectGridContainer.attrs_["disabled"], "false"); 1145 EXPECT_EQ(inspectGridContainer.attrs_["focusable"], "true"); 1146 EXPECT_EQ(inspectGridContainer.styles_.size(), stylesSize + stylesSizeInsert); 1147 EXPECT_EQ(inspectGridContainer.styles_["justify-content"], "flex-start"); 1148 EXPECT_EQ(inspectGridContainer.styles_["align-items"], "stretch"); 1149 EXPECT_EQ(inspectGridContainer.styles_["align-content"], "flex-start"); 1150 } 1151 1152 /** 1153 * @tc.name: InspectGridRowTest001 1154 * @tc.desc: InspectGridRow::InspectGridRow 1155 * @tc.type: FUNC 1156 */ 1157 HWTEST_F(JSInspectorTest, InspectGridRowTest001, TestSize.Level1) 1158 { 1159 NodeId nodeId = -1; 1160 std::string tag = "tagTest"; 1161 InspectGridRow inspectGridRow(nodeId, tag); 1162 EXPECT_EQ(inspectGridRow.nodeId_, nodeId); 1163 EXPECT_EQ(inspectGridRow.tag_, tag); 1164 } 1165 1166 /** 1167 * @tc.name: InspectGridRowTest002 1168 * @tc.desc: InspectGridRow::PackAttrAndStyle 1169 * @tc.type: FUNC 1170 */ 1171 HWTEST_F(JSInspectorTest, InspectGridRowTest002, TestSize.Level1) 1172 { 1173 NodeId nodeId = -1; 1174 std::string tag = "tagTest"; 1175 InspectGridRow inspectGridRow(nodeId, tag); 1176 auto attrsSize = inspectGridRow.attrs_.size(); 1177 auto stylesSize = inspectGridRow.styles_.size(); 1178 uint16_t attrsSizeInsert = 2; 1179 uint16_t stylesSizeInsert = 4; 1180 1181 inspectGridRow.PackAttrAndStyle(); 1182 EXPECT_EQ(inspectGridRow.attrs_.size(), attrsSize + attrsSizeInsert); 1183 EXPECT_EQ(inspectGridRow.attrs_["disabled"], "false"); 1184 EXPECT_EQ(inspectGridRow.attrs_["focusable"], "false"); 1185 EXPECT_EQ(inspectGridRow.styles_.size(), stylesSize + stylesSizeInsert); 1186 EXPECT_EQ(inspectGridRow.styles_["flex-wrap"], "nowrap"); 1187 EXPECT_EQ(inspectGridRow.styles_["justify-content"], "flex-start"); 1188 EXPECT_EQ(inspectGridRow.styles_["align-items"], "flex-start"); 1189 EXPECT_EQ(inspectGridRow.styles_["align-content"], "flex-start"); 1190 EXPECT_EQ(inspectGridRow.styles_.find("padding-left"), inspectGridRow.styles_.end()); 1191 EXPECT_EQ(inspectGridRow.styles_.find("padding-top"), inspectGridRow.styles_.end()); 1192 EXPECT_EQ(inspectGridRow.styles_.find("padding-right"), inspectGridRow.styles_.end()); 1193 EXPECT_EQ(inspectGridRow.styles_.find("padding-bottom"), inspectGridRow.styles_.end()); 1194 EXPECT_EQ(inspectGridRow.styles_.find("padding-start"), inspectGridRow.styles_.end()); 1195 EXPECT_EQ(inspectGridRow.styles_.find("padding-end"), inspectGridRow.styles_.end()); 1196 EXPECT_EQ(inspectGridRow.styles_.find("margin-left"), inspectGridRow.styles_.end()); 1197 EXPECT_EQ(inspectGridRow.styles_.find("margin-top"), inspectGridRow.styles_.end()); 1198 EXPECT_EQ(inspectGridRow.styles_.find("margin-right"), inspectGridRow.styles_.end()); 1199 EXPECT_EQ(inspectGridRow.styles_.find("margin-bottom"), inspectGridRow.styles_.end()); 1200 EXPECT_EQ(inspectGridRow.styles_.find("margin-start"), inspectGridRow.styles_.end()); 1201 EXPECT_EQ(inspectGridRow.styles_.find("margin-end"), inspectGridRow.styles_.end()); 1202 EXPECT_EQ(inspectGridRow.styles_.find("flex-grow"), inspectGridRow.styles_.end()); 1203 EXPECT_EQ(inspectGridRow.styles_.find("flex-shrink"), inspectGridRow.styles_.end()); 1204 EXPECT_EQ(inspectGridRow.styles_.find("position"), inspectGridRow.styles_.end()); 1205 } 1206 1207 /** 1208 * @tc.name: InspectImageAnimatorTest001 1209 * @tc.desc: InspectImageAnimator::InspectImageAnimator 1210 * @tc.type: FUNC 1211 */ 1212 HWTEST_F(JSInspectorTest, InspectImageAnimatorTest001, TestSize.Level1) 1213 { 1214 NodeId nodeId = -1; 1215 std::string tag = "tagTest"; 1216 InspectImageAnimator inspectImageAnimator(nodeId, tag); 1217 EXPECT_EQ(inspectImageAnimator.nodeId_, nodeId); 1218 EXPECT_EQ(inspectImageAnimator.tag_, tag); 1219 } 1220 1221 /** 1222 * @tc.name: InspectImageAnimatorTest002 1223 * @tc.desc: InspectImageAnimator::PackAttrAndStyle 1224 * @tc.type: FUNC 1225 */ 1226 HWTEST_F(JSInspectorTest, InspectImageAnimatorTest002, TestSize.Level1) 1227 { 1228 NodeId nodeId = -1; 1229 std::string tag = "tagTest"; 1230 InspectImageAnimator inspectImageAnimator(nodeId, tag); 1231 auto attrsSize = inspectImageAnimator.attrs_.size(); 1232 uint16_t attrsSizeInsert = 7; 1233 1234 inspectImageAnimator.PackAttrAndStyle(); 1235 EXPECT_EQ(inspectImageAnimator.attrs_.size(), attrsSize + attrsSizeInsert); 1236 EXPECT_EQ(inspectImageAnimator.attrs_["predecode"], "0"); 1237 EXPECT_EQ(inspectImageAnimator.attrs_["iteration"], "infinite"); 1238 EXPECT_EQ(inspectImageAnimator.attrs_["reverse"], "false"); 1239 EXPECT_EQ(inspectImageAnimator.attrs_["fixedsize"], "true"); 1240 EXPECT_EQ(inspectImageAnimator.attrs_["fillmode"], "forwards"); 1241 EXPECT_EQ(inspectImageAnimator.attrs_["disabled"], "false"); 1242 EXPECT_EQ(inspectImageAnimator.attrs_["focusable"], "false"); 1243 } 1244 1245 /** 1246 * @tc.name: InspectImageTest001 1247 * @tc.desc: InspectImage::InspectImage 1248 * @tc.type: FUNC 1249 */ 1250 HWTEST_F(JSInspectorTest, InspectImageTest001, TestSize.Level1) 1251 { 1252 NodeId nodeId = -1; 1253 std::string tag = "tagTest"; 1254 InspectImage inspectImage(nodeId, tag); 1255 EXPECT_EQ(inspectImage.nodeId_, nodeId); 1256 EXPECT_EQ(inspectImage.tag_, tag); 1257 } 1258 1259 /** 1260 * @tc.name: InspectImageTest002 1261 * @tc.desc: InspectImage::PackAttrAndStyle 1262 * @tc.type: FUNC 1263 */ 1264 HWTEST_F(JSInspectorTest, InspectImageTest002, TestSize.Level1) 1265 { 1266 NodeId nodeId = -1; 1267 std::string tag = "tagTest"; 1268 InspectImage inspectImage(nodeId, tag); 1269 auto attrsSize = inspectImage.attrs_.size(); 1270 auto stylesSize = inspectImage.styles_.size(); 1271 uint16_t attrsSizeInsert = 2; 1272 uint16_t stylesSizeInsert = 3; 1273 1274 inspectImage.PackAttrAndStyle(); 1275 EXPECT_EQ(inspectImage.attrs_.size(), attrsSize + attrsSizeInsert); 1276 EXPECT_EQ(inspectImage.attrs_["disabled"], "false"); 1277 EXPECT_EQ(inspectImage.attrs_["focusable"], "false"); 1278 EXPECT_EQ(inspectImage.styles_.size(), stylesSize + stylesSizeInsert); 1279 EXPECT_EQ(inspectImage.styles_["object-fit"], "cover"); 1280 EXPECT_EQ(inspectImage.styles_["match-text-direction"], "false"); 1281 EXPECT_EQ(inspectImage.styles_["fit-original-size"], "false"); 1282 } 1283 1284 /** 1285 * @tc.name: InspectInputTest001 1286 * @tc.desc: InspectInput::InspectInput 1287 * @tc.type: FUNC 1288 */ 1289 HWTEST_F(JSInspectorTest, InspectInputTest001, TestSize.Level1) 1290 { 1291 NodeId nodeId = -1; 1292 std::string tag = "tagTest"; 1293 InspectInput inspectInput(nodeId, tag); 1294 EXPECT_EQ(inspectInput.nodeId_, nodeId); 1295 EXPECT_EQ(inspectInput.tag_, tag); 1296 } 1297 1298 /** 1299 * @tc.name: InspectInputTest002 1300 * @tc.desc: InspectInput::PackAttrAndStyle-PHONE 1301 * @tc.type: FUNC 1302 */ 1303 HWTEST_F(JSInspectorTest, InspectInputTest002, TestSize.Level1) 1304 { 1305 NodeId nodeId = -1; 1306 std::string tag = "tagTest"; 1307 InspectInput inspectInput(nodeId, tag); 1308 auto attrsSize = inspectInput.attrs_.size(); 1309 auto stylesSize = inspectInput.styles_.size(); 1310 1311 DeviceType deviceType = SystemProperties::GetDeviceType(); 1312 SystemProperties::SetDeviceType(DeviceType::PHONE); 1313 inspectInput.PackAttrAndStyle(); 1314 CheckInputAttrAndStyle(inspectInput, attrsSize, stylesSize); 1315 SystemProperties::SetDeviceType(deviceType); 1316 } 1317 1318 /** 1319 * @tc.name: InspectInputTest003 1320 * @tc.desc: InspectInput::PackAttrAndStyle-TV 1321 * @tc.type: FUNC 1322 */ 1323 HWTEST_F(JSInspectorTest, InspectInputTest003, TestSize.Level1) 1324 { 1325 NodeId nodeId = -1; 1326 std::string tag = "tagTest"; 1327 InspectInput inspectInput(nodeId, tag); 1328 auto attrsSize = inspectInput.attrs_.size(); 1329 auto stylesSize = inspectInput.styles_.size(); 1330 1331 DeviceType deviceType = SystemProperties::GetDeviceType(); 1332 SystemProperties::SetDeviceType(DeviceType::TV); 1333 inspectInput.PackAttrAndStyle(); 1334 CheckInputAttrAndStyle(inspectInput, attrsSize, stylesSize); 1335 SystemProperties::SetDeviceType(deviceType); 1336 } 1337 1338 /** 1339 * @tc.name: InspectInputTest004 1340 * @tc.desc: InspectInput::PackAttrAndStyle-WATCH 1341 * @tc.type: FUNC 1342 */ 1343 HWTEST_F(JSInspectorTest, InspectInputTest004, TestSize.Level1) 1344 { 1345 NodeId nodeId = -1; 1346 std::string tag = "tagTest"; 1347 InspectInput inspectInput(nodeId, tag); 1348 auto attrsSize = inspectInput.attrs_.size(); 1349 auto stylesSize = inspectInput.styles_.size(); 1350 1351 DeviceType deviceType = SystemProperties::GetDeviceType(); 1352 SystemProperties::SetDeviceType(DeviceType::WATCH); 1353 inspectInput.PackAttrAndStyle(); 1354 CheckInputAttrAndStyle(inspectInput, attrsSize, stylesSize); 1355 SystemProperties::SetDeviceType(deviceType); 1356 } 1357 1358 /** 1359 * @tc.name: InspectInputTest005 1360 * @tc.desc: InspectInput::PackAttrAndStyle-CAR 1361 * @tc.type: FUNC 1362 */ 1363 HWTEST_F(JSInspectorTest, InspectInputTest005, TestSize.Level1) 1364 { 1365 NodeId nodeId = -1; 1366 std::string tag = "tagTest"; 1367 InspectInput inspectInput(nodeId, tag); 1368 auto attrsSize = inspectInput.attrs_.size(); 1369 auto stylesSize = inspectInput.styles_.size(); 1370 1371 DeviceType deviceType = SystemProperties::GetDeviceType(); 1372 SystemProperties::SetDeviceType(DeviceType::CAR); 1373 inspectInput.PackAttrAndStyle(); 1374 CheckInputAttrAndStyle(inspectInput, attrsSize, stylesSize); 1375 SystemProperties::SetDeviceType(deviceType); 1376 } 1377 1378 /** 1379 * @tc.name: InspectInputTest006 1380 * @tc.desc: InspectInput::PackAttrAndStyle-TABLET 1381 * @tc.type: FUNC 1382 */ 1383 HWTEST_F(JSInspectorTest, InspectInputTest006, TestSize.Level1) 1384 { 1385 NodeId nodeId = -1; 1386 std::string tag = "tagTest"; 1387 InspectInput inspectInput(nodeId, tag); 1388 auto attrsSize = inspectInput.attrs_.size(); 1389 auto stylesSize = inspectInput.styles_.size(); 1390 1391 DeviceType deviceType = SystemProperties::GetDeviceType(); 1392 SystemProperties::SetDeviceType(DeviceType::TABLET); 1393 inspectInput.PackAttrAndStyle(); 1394 CheckInputAttrAndStyle(inspectInput, attrsSize, stylesSize); 1395 SystemProperties::SetDeviceType(deviceType); 1396 } 1397 1398 /** 1399 * @tc.name: InspectInputTest007 1400 * @tc.desc: InspectInput::PackAttrAndStyle-UNKNOWN 1401 * @tc.type: FUNC 1402 */ 1403 HWTEST_F(JSInspectorTest, InspectInputTest007, TestSize.Level1) 1404 { 1405 NodeId nodeId = -1; 1406 std::string tag = "tagTest"; 1407 InspectInput inspectInput(nodeId, tag); 1408 auto attrsSize = inspectInput.attrs_.size(); 1409 auto stylesSize = inspectInput.styles_.size(); 1410 1411 DeviceType deviceType = SystemProperties::GetDeviceType(); 1412 SystemProperties::SetDeviceType(DeviceType::UNKNOWN); 1413 inspectInput.PackAttrAndStyle(); 1414 CheckInputAttrAndStyle(inspectInput, attrsSize, stylesSize); 1415 SystemProperties::SetDeviceType(deviceType); 1416 } 1417 1418 /** 1419 * @tc.name: InspectLabelTest001 1420 * @tc.desc: InspectLabel::InspectLabel 1421 * @tc.type: FUNC 1422 */ 1423 HWTEST_F(JSInspectorTest, InspectLabelTest001, TestSize.Level1) 1424 { 1425 NodeId nodeId = -1; 1426 std::string tag = "tagTest"; 1427 InspectLabel inspectLabel(nodeId, tag); 1428 EXPECT_EQ(inspectLabel.nodeId_, nodeId); 1429 EXPECT_EQ(inspectLabel.tag_, tag); 1430 } 1431 1432 /** 1433 * @tc.name: InspectLabelTest002 1434 * @tc.desc: InspectLabel::PackAttrAndStyle-PHONE 1435 * @tc.type: FUNC 1436 */ 1437 HWTEST_F(JSInspectorTest, InspectLabelTest002, TestSize.Level1) 1438 { 1439 NodeId nodeId = -1; 1440 std::string tag = "tagTest"; 1441 InspectLabel inspectLabel(nodeId, tag); 1442 auto attrsSize = inspectLabel.attrs_.size(); 1443 auto stylesSize = inspectLabel.styles_.size(); 1444 1445 DeviceType deviceType = SystemProperties::GetDeviceType(); 1446 SystemProperties::SetDeviceType(DeviceType::PHONE); 1447 inspectLabel.PackAttrAndStyle(); 1448 CheckLabelAttrAndStyle(inspectLabel, attrsSize, stylesSize); 1449 SystemProperties::SetDeviceType(deviceType); 1450 } 1451 1452 /** 1453 * @tc.name: InspectLabelTest003 1454 * @tc.desc: InspectLabel::PackAttrAndStyle-TV 1455 * @tc.type: FUNC 1456 */ 1457 HWTEST_F(JSInspectorTest, InspectLabelTest003, TestSize.Level1) 1458 { 1459 NodeId nodeId = -1; 1460 std::string tag = "tagTest"; 1461 InspectLabel inspectLabel(nodeId, tag); 1462 auto attrsSize = inspectLabel.attrs_.size(); 1463 auto stylesSize = inspectLabel.styles_.size(); 1464 1465 DeviceType deviceType = SystemProperties::GetDeviceType(); 1466 SystemProperties::SetDeviceType(DeviceType::TV); 1467 inspectLabel.PackAttrAndStyle(); 1468 CheckLabelAttrAndStyle(inspectLabel, attrsSize, stylesSize); 1469 SystemProperties::SetDeviceType(deviceType); 1470 } 1471 1472 /** 1473 * @tc.name: InspectLabelTest004 1474 * @tc.desc: InspectLabel::PackAttrAndStyle-WATCH 1475 * @tc.type: FUNC 1476 */ 1477 HWTEST_F(JSInspectorTest, InspectLabelTest004, TestSize.Level1) 1478 { 1479 NodeId nodeId = -1; 1480 std::string tag = "tagTest"; 1481 InspectLabel inspectLabel(nodeId, tag); 1482 auto attrsSize = inspectLabel.attrs_.size(); 1483 auto stylesSize = inspectLabel.styles_.size(); 1484 1485 DeviceType deviceType = SystemProperties::GetDeviceType(); 1486 SystemProperties::SetDeviceType(DeviceType::WATCH); 1487 inspectLabel.PackAttrAndStyle(); 1488 CheckLabelAttrAndStyle(inspectLabel, attrsSize, stylesSize); 1489 SystemProperties::SetDeviceType(deviceType); 1490 } 1491 1492 /** 1493 * @tc.name: InspectLabelTest005 1494 * @tc.desc: InspectLabel::PackAttrAndStyle-CAR 1495 * @tc.type: FUNC 1496 */ 1497 HWTEST_F(JSInspectorTest, InspectLabelTest005, TestSize.Level1) 1498 { 1499 NodeId nodeId = -1; 1500 std::string tag = "tagTest"; 1501 InspectLabel inspectLabel(nodeId, tag); 1502 auto attrsSize = inspectLabel.attrs_.size(); 1503 auto stylesSize = inspectLabel.styles_.size(); 1504 1505 DeviceType deviceType = SystemProperties::GetDeviceType(); 1506 SystemProperties::SetDeviceType(DeviceType::CAR); 1507 inspectLabel.PackAttrAndStyle(); 1508 CheckLabelAttrAndStyle(inspectLabel, attrsSize, stylesSize); 1509 SystemProperties::SetDeviceType(deviceType); 1510 } 1511 1512 /** 1513 * @tc.name: InspectLabelTest006 1514 * @tc.desc: InspectLabel::PackAttrAndStyle-TABLET 1515 * @tc.type: FUNC 1516 */ 1517 HWTEST_F(JSInspectorTest, InspectLabelTest006, TestSize.Level1) 1518 { 1519 NodeId nodeId = -1; 1520 std::string tag = "tagTest"; 1521 InspectLabel inspectLabel(nodeId, tag); 1522 auto attrsSize = inspectLabel.attrs_.size(); 1523 auto stylesSize = inspectLabel.styles_.size(); 1524 1525 DeviceType deviceType = SystemProperties::GetDeviceType(); 1526 SystemProperties::SetDeviceType(DeviceType::TABLET); 1527 inspectLabel.PackAttrAndStyle(); 1528 CheckLabelAttrAndStyle(inspectLabel, attrsSize, stylesSize); 1529 SystemProperties::SetDeviceType(deviceType); 1530 } 1531 1532 /** 1533 * @tc.name: InspectLabelTest007 1534 * @tc.desc: InspectLabel::PackAttrAndStyle-UNKNOWN 1535 * @tc.type: FUNC 1536 */ 1537 HWTEST_F(JSInspectorTest, InspectLabelTest007, TestSize.Level1) 1538 { 1539 NodeId nodeId = -1; 1540 std::string tag = "tagTest"; 1541 InspectLabel inspectLabel(nodeId, tag); 1542 auto attrsSize = inspectLabel.attrs_.size(); 1543 auto stylesSize = inspectLabel.styles_.size(); 1544 1545 DeviceType deviceType = SystemProperties::GetDeviceType(); 1546 SystemProperties::SetDeviceType(DeviceType::UNKNOWN); 1547 inspectLabel.PackAttrAndStyle(); 1548 CheckLabelAttrAndStyle(inspectLabel, attrsSize, stylesSize); 1549 SystemProperties::SetDeviceType(deviceType); 1550 } 1551 1552 /** 1553 * @tc.name: InspectListItemGroupTest001 1554 * @tc.desc: InspectListItemGroup::InspectListItemGroup 1555 * @tc.type: FUNC 1556 */ 1557 HWTEST_F(JSInspectorTest, InspectListItemGroupTest001, TestSize.Level1) 1558 { 1559 NodeId nodeId = -1; 1560 std::string tag = "tagTest"; 1561 InspectListItemGroup inspectListItemGroup(nodeId, tag); 1562 EXPECT_EQ(inspectListItemGroup.nodeId_, nodeId); 1563 EXPECT_EQ(inspectListItemGroup.tag_, tag); 1564 } 1565 1566 /** 1567 * @tc.name: InspectListItemGroupTest002 1568 * @tc.desc: InspectListItemGroup::PackAttrAndStyle 1569 * @tc.type: FUNC 1570 */ 1571 HWTEST_F(JSInspectorTest, InspectListItemGroupTest002, TestSize.Level1) 1572 { 1573 NodeId nodeId = -1; 1574 std::string tag = "tagTest"; 1575 InspectListItemGroup inspectListItemGroup(nodeId, tag); 1576 auto attrsSize = inspectListItemGroup.attrs_.size(); 1577 auto stylesSize = inspectListItemGroup.styles_.size(); 1578 uint16_t attrsSizeInsert = 3; 1579 uint16_t stylesSizeInsert = 2; 1580 1581 inspectListItemGroup.PackAttrAndStyle(); 1582 EXPECT_EQ(inspectListItemGroup.attrs_.size(), attrsSize + attrsSizeInsert); 1583 EXPECT_EQ(inspectListItemGroup.attrs_["type"], "default"); 1584 EXPECT_EQ(inspectListItemGroup.attrs_["disabled"], "false"); 1585 EXPECT_EQ(inspectListItemGroup.attrs_["focusable"], "true"); 1586 EXPECT_EQ(inspectListItemGroup.styles_.size(), stylesSize + stylesSizeInsert); 1587 EXPECT_EQ(inspectListItemGroup.styles_["flex-direction"], "row"); 1588 EXPECT_EQ(inspectListItemGroup.styles_["justify-content"], "flex-start"); 1589 EXPECT_EQ(inspectListItemGroup.styles_.find("position"), inspectListItemGroup.styles_.end()); 1590 } 1591 1592 /** 1593 * @tc.name: InspectListItemTest001 1594 * @tc.desc: InspectListItem::InspectListItem 1595 * @tc.type: FUNC 1596 */ 1597 HWTEST_F(JSInspectorTest, InspectListItemTest001, TestSize.Level1) 1598 { 1599 NodeId nodeId = -1; 1600 std::string tag = "tagTest"; 1601 InspectListItem inspectListItem(nodeId, tag); 1602 EXPECT_EQ(inspectListItem.nodeId_, nodeId); 1603 EXPECT_EQ(inspectListItem.tag_, tag); 1604 } 1605 1606 /** 1607 * @tc.name: InspectListItemTest002 1608 * @tc.desc: InspectListItem::PackAttrAndStyle 1609 * @tc.type: FUNC 1610 */ 1611 HWTEST_F(JSInspectorTest, InspectListItemTest002, TestSize.Level1) 1612 { 1613 NodeId nodeId = -1; 1614 std::string tag = "tagTest"; 1615 InspectListItem inspectListItem(nodeId, tag); 1616 auto attrsSize = inspectListItem.attrs_.size(); 1617 auto stylesSize = inspectListItem.styles_.size(); 1618 uint16_t attrsSizeInsert = 7; 1619 uint16_t stylesSizeInsert = 1; 1620 1621 inspectListItem.PackAttrAndStyle(); 1622 EXPECT_EQ(inspectListItem.attrs_.size(), attrsSize + attrsSizeInsert); 1623 EXPECT_EQ(inspectListItem.attrs_["type"], "default"); 1624 EXPECT_EQ(inspectListItem.attrs_["primary"], "false"); 1625 EXPECT_EQ(inspectListItem.attrs_["sticky"], "none"); 1626 EXPECT_EQ(inspectListItem.attrs_["stickyradius"], "1000px"); 1627 EXPECT_EQ(inspectListItem.attrs_["clickeffect"], "true"); 1628 EXPECT_EQ(inspectListItem.attrs_["disabled"], "false"); 1629 EXPECT_EQ(inspectListItem.attrs_["focusable"], "true"); 1630 EXPECT_EQ(inspectListItem.styles_.size(), stylesSize + stylesSizeInsert); 1631 EXPECT_EQ(inspectListItem.styles_["column-span"], "1"); 1632 } 1633 1634 /** 1635 * @tc.name: InspectListTest001 1636 * @tc.desc: InspectList::InspectList 1637 * @tc.type: FUNC 1638 */ 1639 HWTEST_F(JSInspectorTest, InspectListTest001, TestSize.Level1) 1640 { 1641 NodeId nodeId = -1; 1642 std::string tag = "tagTest"; 1643 InspectList inspectList(nodeId, tag); 1644 EXPECT_EQ(inspectList.nodeId_, nodeId); 1645 EXPECT_EQ(inspectList.tag_, tag); 1646 } 1647 1648 /** 1649 * @tc.name: InspectListTest002 1650 * @tc.desc: InspectList::PackAttrAndStyle 1651 * @tc.type: FUNC 1652 */ 1653 HWTEST_F(JSInspectorTest, InspectListTest002, TestSize.Level1) 1654 { 1655 NodeId nodeId = -1; 1656 std::string tag = "tagTest"; 1657 InspectList inspectList(nodeId, tag); 1658 auto attrsSize = inspectList.attrs_.size(); 1659 auto stylesSize = inspectList.styles_.size(); 1660 uint16_t attrsSizeInsert = 18; 1661 uint16_t stylesSizeInsert = 7; 1662 1663 inspectList.PackAttrAndStyle(); 1664 EXPECT_EQ(inspectList.attrs_.size(), attrsSize + attrsSizeInsert); 1665 EXPECT_EQ(inspectList.attrs_["scrollpage"], "true"); 1666 EXPECT_EQ(inspectList.attrs_["cachedcount"], "0"); 1667 EXPECT_EQ(inspectList.attrs_["scrollbar"], "off"); 1668 EXPECT_EQ(inspectList.attrs_["scrolleffect"], "spring"); 1669 EXPECT_EQ(inspectList.attrs_["indexer"], "false"); 1670 EXPECT_EQ(inspectList.attrs_["indexermulti"], "false"); 1671 EXPECT_EQ(inspectList.attrs_["indexerbubble"], "true"); 1672 EXPECT_EQ(inspectList.attrs_["divider"], "false"); 1673 EXPECT_EQ(inspectList.attrs_["shapemode"], "default"); 1674 EXPECT_EQ(inspectList.attrs_["itemscale"], "true"); 1675 EXPECT_EQ(inspectList.attrs_["itemcenter"], "false"); 1676 EXPECT_EQ(inspectList.attrs_["updateeffect"], "false"); 1677 EXPECT_EQ(inspectList.attrs_["chainanimation"], "false"); 1678 EXPECT_EQ(inspectList.attrs_["scrollvibrate"], "true"); 1679 EXPECT_EQ(inspectList.attrs_["initialindex"], "0"); 1680 EXPECT_EQ(inspectList.attrs_["initialoffset"], "0"); 1681 EXPECT_EQ(inspectList.attrs_["disabled"], "false"); 1682 EXPECT_EQ(inspectList.attrs_["focusable"], "true"); 1683 EXPECT_EQ(inspectList.styles_.size(), stylesSize + stylesSizeInsert); 1684 EXPECT_EQ(inspectList.styles_["divider-color"], "transparent"); 1685 EXPECT_EQ(inspectList.styles_["divider-height"], "1"); 1686 EXPECT_EQ(inspectList.styles_["divider-origin"], "0"); 1687 EXPECT_EQ(inspectList.styles_["flex-direction"], "column"); 1688 EXPECT_EQ(inspectList.styles_["columns"], "1"); 1689 EXPECT_EQ(inspectList.styles_["align-items"], "stretch"); 1690 EXPECT_EQ(inspectList.styles_["fade-color"], "grey"); 1691 } 1692 1693 /** 1694 * @tc.name: InspectMarqueeTest001 1695 * @tc.desc: InspectMarquee::InspectMarquee 1696 * @tc.type: FUNC 1697 */ 1698 HWTEST_F(JSInspectorTest, InspectMarqueeTest001, TestSize.Level1) 1699 { 1700 NodeId nodeId = -1; 1701 std::string tag = "tagTest"; 1702 InspectMarquee inspectMarquee(nodeId, tag); 1703 EXPECT_EQ(inspectMarquee.nodeId_, nodeId); 1704 EXPECT_EQ(inspectMarquee.tag_, tag); 1705 } 1706 1707 /** 1708 * @tc.name: InspectMarqueeTest002 1709 * @tc.desc: InspectMarquee::PackAttrAndStyle-PHONE 1710 * @tc.type: FUNC 1711 */ 1712 HWTEST_F(JSInspectorTest, InspectMarqueeTest002, TestSize.Level1) 1713 { 1714 NodeId nodeId = -1; 1715 std::string tag = "tagTest"; 1716 InspectMarquee inspectMarquee(nodeId, tag); 1717 auto attrsSize = inspectMarquee.attrs_.size(); 1718 auto stylesSize = inspectMarquee.styles_.size(); 1719 1720 DeviceType deviceType = SystemProperties::GetDeviceType(); 1721 SystemProperties::SetDeviceType(DeviceType::PHONE); 1722 inspectMarquee.PackAttrAndStyle(); 1723 CheckMarqueeAttrAndStyle(inspectMarquee, attrsSize, stylesSize); 1724 SystemProperties::SetDeviceType(deviceType); 1725 } 1726 1727 /** 1728 * @tc.name: InspectMarqueeTest003 1729 * @tc.desc: InspectMarquee::PackAttrAndStyle-TV 1730 * @tc.type: FUNC 1731 */ 1732 HWTEST_F(JSInspectorTest, InspectMarqueeTest003, TestSize.Level1) 1733 { 1734 NodeId nodeId = -1; 1735 std::string tag = "tagTest"; 1736 InspectMarquee inspectMarquee(nodeId, tag); 1737 auto attrsSize = inspectMarquee.attrs_.size(); 1738 auto stylesSize = inspectMarquee.styles_.size(); 1739 1740 DeviceType deviceType = SystemProperties::GetDeviceType(); 1741 SystemProperties::SetDeviceType(DeviceType::TV); 1742 inspectMarquee.PackAttrAndStyle(); 1743 CheckMarqueeAttrAndStyle(inspectMarquee, attrsSize, stylesSize); 1744 SystemProperties::SetDeviceType(deviceType); 1745 } 1746 1747 /** 1748 * @tc.name: InspectMarqueeTest004 1749 * @tc.desc: InspectMarquee::PackAttrAndStyle-WATCH 1750 * @tc.type: FUNC 1751 */ 1752 HWTEST_F(JSInspectorTest, InspectMarqueeTest004, TestSize.Level1) 1753 { 1754 NodeId nodeId = -1; 1755 std::string tag = "tagTest"; 1756 InspectMarquee inspectMarquee(nodeId, tag); 1757 auto attrsSize = inspectMarquee.attrs_.size(); 1758 auto stylesSize = inspectMarquee.styles_.size(); 1759 1760 DeviceType deviceType = SystemProperties::GetDeviceType(); 1761 SystemProperties::SetDeviceType(DeviceType::WATCH); 1762 inspectMarquee.PackAttrAndStyle(); 1763 CheckMarqueeAttrAndStyle(inspectMarquee, attrsSize, stylesSize); 1764 SystemProperties::SetDeviceType(deviceType); 1765 } 1766 1767 /** 1768 * @tc.name: InspectMarqueeTest005 1769 * @tc.desc: InspectMarquee::PackAttrAndStyle-CAR 1770 * @tc.type: FUNC 1771 */ 1772 HWTEST_F(JSInspectorTest, InspectMarqueeTest005, TestSize.Level1) 1773 { 1774 NodeId nodeId = -1; 1775 std::string tag = "tagTest"; 1776 InspectMarquee inspectMarquee(nodeId, tag); 1777 auto attrsSize = inspectMarquee.attrs_.size(); 1778 auto stylesSize = inspectMarquee.styles_.size(); 1779 1780 DeviceType deviceType = SystemProperties::GetDeviceType(); 1781 SystemProperties::SetDeviceType(DeviceType::CAR); 1782 inspectMarquee.PackAttrAndStyle(); 1783 CheckMarqueeAttrAndStyle(inspectMarquee, attrsSize, stylesSize); 1784 SystemProperties::SetDeviceType(deviceType); 1785 } 1786 1787 /** 1788 * @tc.name: InspectMarqueeTest006 1789 * @tc.desc: InspectMarquee::PackAttrAndStyle-TABLET 1790 * @tc.type: FUNC 1791 */ 1792 HWTEST_F(JSInspectorTest, InspectMarqueeTest006, TestSize.Level1) 1793 { 1794 NodeId nodeId = -1; 1795 std::string tag = "tagTest"; 1796 InspectMarquee inspectMarquee(nodeId, tag); 1797 auto attrsSize = inspectMarquee.attrs_.size(); 1798 auto stylesSize = inspectMarquee.styles_.size(); 1799 1800 DeviceType deviceType = SystemProperties::GetDeviceType(); 1801 SystemProperties::SetDeviceType(DeviceType::TABLET); 1802 inspectMarquee.PackAttrAndStyle(); 1803 CheckMarqueeAttrAndStyle(inspectMarquee, attrsSize, stylesSize); 1804 SystemProperties::SetDeviceType(deviceType); 1805 } 1806 1807 /** 1808 * @tc.name: InspectMarqueeTest007 1809 * @tc.desc: InspectMarquee::PackAttrAndStyle-UNKNOWN 1810 * @tc.type: FUNC 1811 */ 1812 HWTEST_F(JSInspectorTest, InspectMarqueeTest007, TestSize.Level1) 1813 { 1814 NodeId nodeId = -1; 1815 std::string tag = "tagTest"; 1816 InspectMarquee inspectMarquee(nodeId, tag); 1817 auto attrsSize = inspectMarquee.attrs_.size(); 1818 auto stylesSize = inspectMarquee.styles_.size(); 1819 1820 DeviceType deviceType = SystemProperties::GetDeviceType(); 1821 SystemProperties::SetDeviceType(DeviceType::UNKNOWN); 1822 inspectMarquee.PackAttrAndStyle(); 1823 CheckMarqueeAttrAndStyle(inspectMarquee, attrsSize, stylesSize); 1824 SystemProperties::SetDeviceType(deviceType); 1825 } 1826 1827 /** 1828 * @tc.name: InspectMenuTest001 1829 * @tc.desc: InspectMenu::InspectMenu 1830 * @tc.type: FUNC 1831 */ 1832 HWTEST_F(JSInspectorTest, InspectMenuTest001, TestSize.Level1) 1833 { 1834 NodeId nodeId = -1; 1835 std::string tag = "tagTest"; 1836 InspectMenu inspectMenu(nodeId, tag); 1837 EXPECT_EQ(inspectMenu.nodeId_, nodeId); 1838 EXPECT_EQ(inspectMenu.tag_, tag); 1839 } 1840 1841 /** 1842 * @tc.name: InspectMenuTest002 1843 * @tc.desc: InspectMenu::PackAttrAndStyle 1844 * @tc.type: FUNC 1845 */ 1846 HWTEST_F(JSInspectorTest, InspectMenuTest002, TestSize.Level1) 1847 { 1848 NodeId nodeId = -1; 1849 std::string tag = "tagTest"; 1850 InspectMenu inspectMenu(nodeId, tag); 1851 auto attrsSize = inspectMenu.attrs_.size(); 1852 auto stylesSize = inspectMenu.styles_.size(); 1853 uint16_t attrsSizeInsert = 1; 1854 uint16_t stylesSizeInsert = 6; 1855 1856 inspectMenu.PackAttrAndStyle(); 1857 EXPECT_EQ(inspectMenu.attrs_.size(), attrsSize + attrsSizeInsert); 1858 EXPECT_EQ(inspectMenu.attrs_["type"], "click"); 1859 EXPECT_EQ(inspectMenu.styles_.size(), stylesSize + stylesSizeInsert); 1860 EXPECT_EQ(inspectMenu.styles_["font-size"], "30px"); 1861 EXPECT_EQ(inspectMenu.styles_["allow-scale"], "true"); 1862 EXPECT_EQ(inspectMenu.styles_["letter-spacing"], "0"); 1863 EXPECT_EQ(inspectMenu.styles_["font-style"], "normal"); 1864 EXPECT_EQ(inspectMenu.styles_["font-weight"], "normal"); 1865 EXPECT_EQ(inspectMenu.styles_["font-family"], "sans-serif"); 1866 } 1867 1868 /** 1869 * @tc.name: InspectNavigationBarTest001 1870 * @tc.desc: InspectNavigationBar::InspectNavigationBar 1871 * @tc.type: FUNC 1872 */ 1873 HWTEST_F(JSInspectorTest, InspectNavigationBarTest001, TestSize.Level1) 1874 { 1875 NodeId nodeId = -1; 1876 std::string tag = "tagTest"; 1877 InspectNavigationBar inspectNavigationBar(nodeId, tag); 1878 EXPECT_EQ(inspectNavigationBar.nodeId_, nodeId); 1879 EXPECT_EQ(inspectNavigationBar.tag_, tag); 1880 } 1881 1882 /** 1883 * @tc.name: InspectNavigationBarTest002 1884 * @tc.desc: InspectNavigationBar::PackAttrAndStyle 1885 * @tc.type: FUNC 1886 */ 1887 HWTEST_F(JSInspectorTest, InspectNavigationBarTest002, TestSize.Level1) 1888 { 1889 NodeId nodeId = -1; 1890 std::string tag = "tagTest"; 1891 InspectNavigationBar inspectNavigationBar(nodeId, tag); 1892 auto attrsSize = inspectNavigationBar.attrs_.size(); 1893 auto stylesSize = inspectNavigationBar.styles_.size(); 1894 uint16_t attrsSizeInsert = 2; 1895 uint16_t stylesSizeInsert = 3; 1896 1897 inspectNavigationBar.PackAttrAndStyle(); 1898 EXPECT_EQ(inspectNavigationBar.attrs_.size(), attrsSize + attrsSizeInsert); 1899 EXPECT_EQ(inspectNavigationBar.attrs_["type"], "normal"); 1900 EXPECT_EQ(inspectNavigationBar.attrs_["backenabled"], "false"); 1901 EXPECT_EQ(inspectNavigationBar.styles_.size(), stylesSize + stylesSizeInsert); 1902 EXPECT_EQ(inspectNavigationBar.styles_["background-repeat"], "repeat"); 1903 EXPECT_EQ(inspectNavigationBar.styles_["opacity"], "1"); 1904 EXPECT_EQ(inspectNavigationBar.styles_["visibility"], "visible"); 1905 } 1906 1907 /** 1908 * @tc.name: InspectNodeTest001 1909 * @tc.desc: InspectNode::InspectNode 1910 * @tc.type: FUNC 1911 */ 1912 HWTEST_F(JSInspectorTest, InspectNodeTest001, TestSize.Level1) 1913 { 1914 NodeId nodeId = -1; 1915 std::string tag = "tagTest"; 1916 InspectNode inspectNode(nodeId, tag); 1917 EXPECT_EQ(inspectNode.nodeId_, nodeId); 1918 EXPECT_EQ(inspectNode.tag_, tag); 1919 } 1920 1921 /** 1922 * @tc.name: InspectNodeTest002 1923 * @tc.desc: InspectNode::PackAttrAndStyle 1924 * @tc.type: FUNC 1925 */ 1926 HWTEST_F(JSInspectorTest, InspectNodeTest002, TestSize.Level1) 1927 { 1928 NodeId nodeId = -1; 1929 std::string tag = "tagTest"; 1930 InspectNode inspectNode(nodeId, tag); 1931 auto attrsSize = inspectNode.attrs_.size(); 1932 auto stylesSize = inspectNode.styles_.size(); 1933 inspectNode.PackAttrAndStyle(); 1934 EXPECT_EQ(inspectNode.attrs_.size(), attrsSize); 1935 EXPECT_EQ(inspectNode.styles_.size(), stylesSize); 1936 } 1937 1938 /** 1939 * @tc.name: InspectNodeTest003 1940 * @tc.desc: InspectNode::InitCommonStyles 1941 * @tc.type: FUNC 1942 */ 1943 HWTEST_F(JSInspectorTest, InspectNodeTest003, TestSize.Level1) 1944 { 1945 NodeId nodeId = -1; 1946 std::string tag = "tagTest"; 1947 InspectNode inspectNode(nodeId, tag); 1948 auto stylesSize = inspectNode.styles_.size(); 1949 uint16_t stylesSizeInsert = 34; 1950 1951 inspectNode.InitCommonStyles(); 1952 EXPECT_EQ(inspectNode.styles_.size(), stylesSize + stylesSizeInsert); 1953 EXPECT_EQ(inspectNode.styles_["padding-left"], "0"); 1954 EXPECT_EQ(inspectNode.styles_["padding-top"], "0"); 1955 EXPECT_EQ(inspectNode.styles_["padding-right"], "0"); 1956 EXPECT_EQ(inspectNode.styles_["padding-bottom"], "0"); 1957 EXPECT_EQ(inspectNode.styles_["padding-start"], "0"); 1958 EXPECT_EQ(inspectNode.styles_["padding-end"], "0"); 1959 EXPECT_EQ(inspectNode.styles_["margin-left"], "0"); 1960 EXPECT_EQ(inspectNode.styles_["margin-top"], "0"); 1961 EXPECT_EQ(inspectNode.styles_["margin-right"], "0"); 1962 EXPECT_EQ(inspectNode.styles_["margin-bottom"], "0"); 1963 EXPECT_EQ(inspectNode.styles_["margin-start"], "0"); 1964 EXPECT_EQ(inspectNode.styles_["margin-end"], "0"); 1965 EXPECT_EQ(inspectNode.styles_["border"], "0"); 1966 EXPECT_EQ(inspectNode.styles_["border-left-style"], "solid"); 1967 EXPECT_EQ(inspectNode.styles_["border-top-style"], "solid"); 1968 EXPECT_EQ(inspectNode.styles_["border-right-style"], "solid"); 1969 EXPECT_EQ(inspectNode.styles_["border-bottom-style"], "solid"); 1970 EXPECT_EQ(inspectNode.styles_["border-left-width"], "0"); 1971 EXPECT_EQ(inspectNode.styles_["border-top-width"], "0"); 1972 EXPECT_EQ(inspectNode.styles_["border-right-width"], "0"); 1973 EXPECT_EQ(inspectNode.styles_["border-bottom-width"], "0"); 1974 EXPECT_EQ(inspectNode.styles_["border-left-color"], "black"); 1975 EXPECT_EQ(inspectNode.styles_["border-top-color"], "black"); 1976 EXPECT_EQ(inspectNode.styles_["border-right-color"], "black"); 1977 EXPECT_EQ(inspectNode.styles_["border-bottom-color"], "black"); 1978 EXPECT_EQ(inspectNode.styles_["background-size"], "auto"); 1979 EXPECT_EQ(inspectNode.styles_["background-repeat"], "repeat"); 1980 EXPECT_EQ(inspectNode.styles_["background-position"], "0px 0px"); 1981 EXPECT_EQ(inspectNode.styles_["opacity"], "1"); 1982 EXPECT_EQ(inspectNode.styles_["display"], "flex"); 1983 EXPECT_EQ(inspectNode.styles_["visibility"], "visible"); 1984 EXPECT_EQ(inspectNode.styles_["flex-grow"], "0"); 1985 EXPECT_EQ(inspectNode.styles_["flex-shrink"], "1"); 1986 EXPECT_EQ(inspectNode.styles_["position"], "relative"); 1987 } 1988 1989 /** 1990 * @tc.name: InspectNodeTest004 1991 * @tc.desc: InspectNode::SetAllAttr 1992 * @tc.type: FUNC 1993 */ 1994 HWTEST_F(JSInspectorTest, InspectNodeTest004, TestSize.Level1) 1995 { 1996 NodeId nodeId = -1; 1997 std::string tag = "tagTest"; 1998 InspectNode inspectNode(nodeId, tag); 1999 inspectNode.attrs_.insert(std::make_pair("disabled", "false")); 2000 auto rootJsonValue = JsonUtil::Create(true); 2001 auto attrsJsonValue = JsonUtil::Create(true); 2002 attrsJsonValue->Put("disabled", "false"); 2003 inspectNode.SetAllAttr(rootJsonValue, INSPECTOR_ATTRS); 2004 EXPECT_EQ(rootJsonValue->GetObject(INSPECTOR_ATTRS)->ToString(), attrsJsonValue->ToString()); 2005 } 2006 2007 /** 2008 * @tc.name: InspectNodeTest005 2009 * @tc.desc: InspectNode::SetAllStyle 2010 * @tc.type: FUNC 2011 */ 2012 HWTEST_F(JSInspectorTest, InspectNodeTest005, TestSize.Level1) 2013 { 2014 NodeId nodeId = -1; 2015 std::string tag = "tagTest"; 2016 InspectNode inspectNode(nodeId, tag); 2017 inspectNode.styles_.insert(std::make_pair("position", "relative")); 2018 auto rootJsonValue = JsonUtil::Create(true); 2019 auto stylesJsonValue = JsonUtil::Create(true); 2020 stylesJsonValue->Put("position", "relative"); 2021 inspectNode.SetAllStyle(rootJsonValue, INSPECTOR_STYLES); 2022 EXPECT_EQ(rootJsonValue->GetObject(INSPECTOR_STYLES)->ToString(), stylesJsonValue->ToString()); 2023 } 2024 2025 /** 2026 * @tc.name: InspectOptionTest001 2027 * @tc.desc: InspectOption::InspectOption 2028 * @tc.type: FUNC 2029 */ 2030 HWTEST_F(JSInspectorTest, InspectOptionTest001, TestSize.Level1) 2031 { 2032 NodeId nodeId = -1; 2033 std::string tag = "tagTest"; 2034 InspectOption inspectOption(nodeId, tag); 2035 EXPECT_EQ(inspectOption.nodeId_, nodeId); 2036 EXPECT_EQ(inspectOption.tag_, tag); 2037 } 2038 2039 /** 2040 * @tc.name: InspectOptionTest002 2041 * @tc.desc: InspectOption::PackAttrAndStyle 2042 * @tc.type: FUNC 2043 */ 2044 HWTEST_F(JSInspectorTest, InspectOptionTest002, TestSize.Level1) 2045 { 2046 NodeId nodeId = -1; 2047 std::string tag = "tagTest"; 2048 InspectOption inspectOption(nodeId, tag); 2049 auto attrsSize = inspectOption.attrs_.size(); 2050 auto stylesSize = inspectOption.styles_.size(); 2051 uint16_t attrsSizeInsert = 3; 2052 uint16_t stylesSizeInsert = 6; 2053 2054 inspectOption.PackAttrAndStyle(); 2055 EXPECT_EQ(inspectOption.attrs_.size(), attrsSize + attrsSizeInsert); 2056 EXPECT_EQ(inspectOption.attrs_["action"], "show"); 2057 EXPECT_EQ(inspectOption.attrs_["focusable"], "true"); 2058 EXPECT_EQ(inspectOption.attrs_["disabled"], "false"); 2059 EXPECT_EQ(inspectOption.styles_.size(), stylesSize + stylesSizeInsert); 2060 EXPECT_EQ(inspectOption.styles_["color"], "#e6000000"); 2061 EXPECT_EQ(inspectOption.styles_["font-size"], "16px"); 2062 EXPECT_EQ(inspectOption.styles_["allow-scale"], "true"); 2063 EXPECT_EQ(inspectOption.styles_["font-weight"], "normal"); 2064 EXPECT_EQ(inspectOption.styles_["text-decoration"], "none"); 2065 EXPECT_EQ(inspectOption.styles_["font-family"], "sans-serif"); 2066 } 2067 2068 /** 2069 * @tc.name: InspectPanelTest001 2070 * @tc.desc: InspectPanel::InspectPanel 2071 * @tc.type: FUNC 2072 */ 2073 HWTEST_F(JSInspectorTest, InspectPanelTest001, TestSize.Level1) 2074 { 2075 NodeId nodeId = -1; 2076 std::string tag = "tagTest"; 2077 InspectPanel inspectPanel(nodeId, tag); 2078 EXPECT_EQ(inspectPanel.nodeId_, nodeId); 2079 EXPECT_EQ(inspectPanel.tag_, tag); 2080 } 2081 2082 /** 2083 * @tc.name: InspectPanelTest002 2084 * @tc.desc: InspectPanel::PackAttrAndStyle 2085 * @tc.type: FUNC 2086 */ 2087 HWTEST_F(JSInspectorTest, InspectPanelTest002, TestSize.Level1) 2088 { 2089 NodeId nodeId = -1; 2090 std::string tag = "tagTest"; 2091 InspectPanel inspectPanel(nodeId, tag); 2092 auto attrsSize = inspectPanel.attrs_.size(); 2093 uint16_t attrsSizeInsert = 2; 2094 2095 inspectPanel.PackAttrAndStyle(); 2096 EXPECT_EQ(inspectPanel.attrs_.size(), attrsSize + attrsSizeInsert); 2097 EXPECT_EQ(inspectPanel.attrs_["mode"], "full"); 2098 EXPECT_EQ(inspectPanel.attrs_["dragbar"], "true"); 2099 EXPECT_EQ(inspectPanel.styles_.find("display"), inspectPanel.styles_.end()); 2100 EXPECT_EQ(inspectPanel.styles_.find("visibility"), inspectPanel.styles_.end()); 2101 EXPECT_EQ(inspectPanel.styles_.find("flex-grow"), inspectPanel.styles_.end()); 2102 EXPECT_EQ(inspectPanel.styles_.find("flex-shrink"), inspectPanel.styles_.end()); 2103 EXPECT_EQ(inspectPanel.styles_.find("position"), inspectPanel.styles_.end()); 2104 } 2105 2106 /** 2107 * @tc.name: InspectPickerTest001 2108 * @tc.desc: InspectPicker::InspectPicker 2109 * @tc.type: FUNC 2110 */ 2111 HWTEST_F(JSInspectorTest, InspectPickerTest001, TestSize.Level1) 2112 { 2113 NodeId nodeId = -1; 2114 std::string tag = "tagTest"; 2115 InspectPicker inspectPicker(nodeId, tag); 2116 EXPECT_EQ(inspectPicker.nodeId_, nodeId); 2117 EXPECT_EQ(inspectPicker.tag_, tag); 2118 } 2119 2120 /** 2121 * @tc.name: InspectPickerTest002 2122 * @tc.desc: InspectPicker::PackAttrAndStyle 2123 * @tc.type: FUNC 2124 */ 2125 HWTEST_F(JSInspectorTest, InspectPickerTest002, TestSize.Level1) 2126 { 2127 NodeId nodeId = -1; 2128 std::string tag = "tagTest"; 2129 InspectPicker inspectPicker(nodeId, tag); 2130 auto attrsSize = inspectPicker.attrs_.size(); 2131 auto stylesSize = inspectPicker.styles_.size(); 2132 uint16_t attrsSizeInsert = 10; 2133 uint16_t stylesSizeInsert = 8; 2134 2135 inspectPicker.PackAttrAndStyle(); 2136 EXPECT_EQ(inspectPicker.attrs_.size(), attrsSize + attrsSizeInsert); 2137 EXPECT_EQ(inspectPicker.attrs_["disabled"], "false"); 2138 EXPECT_EQ(inspectPicker.attrs_["focusable"], "true"); 2139 EXPECT_EQ(inspectPicker.attrs_["vibrate"], "true"); 2140 EXPECT_EQ(inspectPicker.attrs_["selected"], "0"); 2141 EXPECT_EQ(inspectPicker.attrs_["start"], "1970-1-1"); 2142 EXPECT_EQ(inspectPicker.attrs_["end"], "2100-12-31"); 2143 EXPECT_EQ(inspectPicker.attrs_["lunar"], "false"); 2144 EXPECT_EQ(inspectPicker.attrs_["lunarswitch"], "false"); 2145 EXPECT_EQ(inspectPicker.attrs_["containsecond"], "false"); 2146 EXPECT_EQ(inspectPicker.attrs_["hours"], "24"); 2147 EXPECT_EQ(inspectPicker.styles_.size(), stylesSize + stylesSizeInsert); 2148 EXPECT_EQ(inspectPicker.styles_["text-color"], "#e6000000"); 2149 EXPECT_EQ(inspectPicker.styles_["font-size"], "30px"); 2150 EXPECT_EQ(inspectPicker.styles_["allow-scale"], "true"); 2151 EXPECT_EQ(inspectPicker.styles_["letter-spacing"], "0"); 2152 EXPECT_EQ(inspectPicker.styles_["font-style"], "normal"); 2153 EXPECT_EQ(inspectPicker.styles_["font-weight"], "normal"); 2154 EXPECT_EQ(inspectPicker.styles_["font-family"], "sans-serif"); 2155 EXPECT_EQ(inspectPicker.styles_["line-height"], "0px"); 2156 } 2157 2158 /** 2159 * @tc.name: InspectPickerViewTest001 2160 * @tc.desc: InspectPickerView::InspectPickerView 2161 * @tc.type: FUNC 2162 */ 2163 HWTEST_F(JSInspectorTest, InspectPickerViewTest001, TestSize.Level1) 2164 { 2165 NodeId nodeId = -1; 2166 std::string tag = "tagTest"; 2167 InspectPickerView inspectPickerView(nodeId, tag); 2168 EXPECT_EQ(inspectPickerView.nodeId_, nodeId); 2169 EXPECT_EQ(inspectPickerView.tag_, tag); 2170 } 2171 2172 /** 2173 * @tc.name: InspectPickerViewTest002 2174 * @tc.desc: InspectPickerView::PackAttrAndStyle 2175 * @tc.type: FUNC 2176 */ 2177 HWTEST_F(JSInspectorTest, InspectPickerViewTest002, TestSize.Level1) 2178 { 2179 NodeId nodeId = -1; 2180 std::string tag = "tagTest"; 2181 InspectPickerView inspectPickerView(nodeId, tag); 2182 auto attrsSize = inspectPickerView.attrs_.size(); 2183 auto stylesSize = inspectPickerView.styles_.size(); 2184 uint16_t attrsSizeInsert = 10; 2185 uint16_t stylesSizeInsert = 9; 2186 2187 inspectPickerView.PackAttrAndStyle(); 2188 EXPECT_EQ(inspectPickerView.attrs_.size(), attrsSize + attrsSizeInsert); 2189 EXPECT_EQ(inspectPickerView.attrs_["type"], "text"); 2190 EXPECT_EQ(inspectPickerView.attrs_["disabled"], "false"); 2191 EXPECT_EQ(inspectPickerView.attrs_["focusable"], "true"); 2192 EXPECT_EQ(inspectPickerView.attrs_["selected"], "0"); 2193 EXPECT_EQ(inspectPickerView.attrs_["start"], "1970-1-1"); 2194 EXPECT_EQ(inspectPickerView.attrs_["end"], "2100-12-31"); 2195 EXPECT_EQ(inspectPickerView.attrs_["lunar"], "false"); 2196 EXPECT_EQ(inspectPickerView.attrs_["lunarswitch"], "false"); 2197 EXPECT_EQ(inspectPickerView.attrs_["containsecond"], "false"); 2198 EXPECT_EQ(inspectPickerView.attrs_["hours"], "24"); 2199 EXPECT_EQ(inspectPickerView.styles_.size(), stylesSize + stylesSizeInsert); 2200 EXPECT_EQ(inspectPickerView.styles_["color"], "#808080"); 2201 EXPECT_EQ(inspectPickerView.styles_["font-size"], "30px"); 2202 EXPECT_EQ(inspectPickerView.styles_["selected-color"], "#ffffff"); 2203 EXPECT_EQ(inspectPickerView.styles_["selected-font-size"], "38px"); 2204 EXPECT_EQ(inspectPickerView.styles_["focus-color"], "#ffffff"); 2205 EXPECT_EQ(inspectPickerView.styles_["focus-font-size"], "38px"); 2206 EXPECT_EQ(inspectPickerView.styles_["disappear-color"], "#ffffff"); 2207 EXPECT_EQ(inspectPickerView.styles_["disappear-font-size"], "14px"); 2208 EXPECT_EQ(inspectPickerView.styles_["font-family"], "sans-serif"); 2209 } 2210 2211 /** 2212 * @tc.name: InspectPieceTest001 2213 * @tc.desc: InspectPiece::InspectPiece 2214 * @tc.type: FUNC 2215 */ 2216 HWTEST_F(JSInspectorTest, InspectPieceTest001, TestSize.Level1) 2217 { 2218 NodeId nodeId = -1; 2219 std::string tag = "tagTest"; 2220 InspectPiece inspectPiece(nodeId, tag); 2221 EXPECT_EQ(inspectPiece.nodeId_, nodeId); 2222 EXPECT_EQ(inspectPiece.tag_, tag); 2223 } 2224 2225 /** 2226 * @tc.name: InspectPieceTest002 2227 * @tc.desc: InspectPiece::PackAttrAndStyle 2228 * @tc.type: FUNC 2229 */ 2230 HWTEST_F(JSInspectorTest, InspectPieceTest002, TestSize.Level1) 2231 { 2232 NodeId nodeId = -1; 2233 std::string tag = "tagTest"; 2234 InspectPiece inspectPiece(nodeId, tag); 2235 auto attrsSize = inspectPiece.attrs_.size(); 2236 auto stylesSize = inspectPiece.styles_.size(); 2237 uint16_t attrsSizeInsert = 3; 2238 2239 inspectPiece.PackAttrAndStyle(); 2240 EXPECT_EQ(inspectPiece.attrs_.size(), attrsSize + attrsSizeInsert); 2241 EXPECT_EQ(inspectPiece.attrs_["closable"], "false"); 2242 EXPECT_EQ(inspectPiece.attrs_["disabled"], "false"); 2243 EXPECT_EQ(inspectPiece.attrs_["focusable"], "false"); 2244 EXPECT_EQ(inspectPiece.styles_.size(), stylesSize); 2245 } 2246 2247 /** 2248 * @tc.name: InspectPopupTest001 2249 * @tc.desc: InspectPopup::InspectPopup 2250 * @tc.type: FUNC 2251 */ 2252 HWTEST_F(JSInspectorTest, InspectPopupTest001, TestSize.Level1) 2253 { 2254 NodeId nodeId = -1; 2255 std::string tag = "tagTest"; 2256 InspectPopup inspectPopup(nodeId, tag); 2257 EXPECT_EQ(inspectPopup.nodeId_, nodeId); 2258 EXPECT_EQ(inspectPopup.tag_, tag); 2259 } 2260 2261 /** 2262 * @tc.name: InspectPopupTest002 2263 * @tc.desc: InspectPopup::PackAttrAndStyle 2264 * @tc.type: FUNC 2265 */ 2266 HWTEST_F(JSInspectorTest, InspectPopupTest002, TestSize.Level1) 2267 { 2268 NodeId nodeId = -1; 2269 std::string tag = "tagTest"; 2270 InspectPopup inspectPopup(nodeId, tag); 2271 auto attrsSize = inspectPopup.attrs_.size(); 2272 auto stylesSize = inspectPopup.styles_.size(); 2273 uint16_t attrsSizeInsert = 5; 2274 uint16_t stylesSizeInsert = 1; 2275 2276 inspectPopup.PackAttrAndStyle(); 2277 EXPECT_EQ(inspectPopup.attrs_.size(), attrsSize + attrsSizeInsert); 2278 EXPECT_EQ(inspectPopup.attrs_["placement"], "bottom"); 2279 EXPECT_EQ(inspectPopup.attrs_["keepalive"], "false"); 2280 EXPECT_EQ(inspectPopup.attrs_["clickable"], "true"); 2281 EXPECT_EQ(inspectPopup.attrs_["arrowoffset"], "0"); 2282 EXPECT_EQ(inspectPopup.attrs_["disabled"], "false"); 2283 EXPECT_EQ(inspectPopup.styles_.size(), stylesSize + stylesSizeInsert); 2284 EXPECT_EQ(inspectPopup.styles_["mask-color"], "#00000000"); 2285 EXPECT_EQ(inspectPopup.styles_.find("flex-grow"), inspectPopup.styles_.end()); 2286 EXPECT_EQ(inspectPopup.styles_.find("flex-shrink"), inspectPopup.styles_.end()); 2287 EXPECT_EQ(inspectPopup.styles_.find("position"), inspectPopup.styles_.end()); 2288 } 2289 2290 /** 2291 * @tc.name: InspectProgressTest001 2292 * @tc.desc: InspectProgress::InspectProgress 2293 * @tc.type: FUNC 2294 */ 2295 HWTEST_F(JSInspectorTest, InspectProgressTest001, TestSize.Level1) 2296 { 2297 NodeId nodeId = -1; 2298 std::string tag = "tagTest"; 2299 InspectProgress inspectProgress(nodeId, tag); 2300 EXPECT_EQ(inspectProgress.nodeId_, nodeId); 2301 EXPECT_EQ(inspectProgress.tag_, tag); 2302 } 2303 2304 /** 2305 * @tc.name: InspectProgressTest002 2306 * @tc.desc: InspectProgress::PackAttrAndStyle-PHONE 2307 * @tc.type: FUNC 2308 */ 2309 HWTEST_F(JSInspectorTest, InspectProgressTest002, TestSize.Level1) 2310 { 2311 NodeId nodeId = -1; 2312 std::string tag = "tagTest"; 2313 InspectProgress inspectProgress(nodeId, tag); 2314 auto attrsSize = inspectProgress.attrs_.size(); 2315 auto stylesSize = inspectProgress.styles_.size(); 2316 2317 DeviceType deviceType = SystemProperties::GetDeviceType(); 2318 SystemProperties::SetDeviceType(DeviceType::PHONE); 2319 inspectProgress.PackAttrAndStyle(); 2320 CheckProgressAttrAndStyle(inspectProgress, attrsSize, stylesSize); 2321 SystemProperties::SetDeviceType(deviceType); 2322 } 2323 2324 /** 2325 * @tc.name: InspectProgressTest003 2326 * @tc.desc: InspectProgress::PackAttrAndStyle-TV 2327 * @tc.type: FUNC 2328 */ 2329 HWTEST_F(JSInspectorTest, InspectProgressTest003, TestSize.Level1) 2330 { 2331 NodeId nodeId = -1; 2332 std::string tag = "tagTest"; 2333 InspectProgress inspectProgress(nodeId, tag); 2334 auto attrsSize = inspectProgress.attrs_.size(); 2335 auto stylesSize = inspectProgress.styles_.size(); 2336 2337 DeviceType deviceType = SystemProperties::GetDeviceType(); 2338 SystemProperties::SetDeviceType(DeviceType::TV); 2339 inspectProgress.PackAttrAndStyle(); 2340 CheckProgressAttrAndStyle(inspectProgress, attrsSize, stylesSize); 2341 SystemProperties::SetDeviceType(deviceType); 2342 } 2343 2344 /** 2345 * @tc.name: InspectProgressTest004 2346 * @tc.desc: InspectProgress::PackAttrAndStyle-WATCH 2347 * @tc.type: FUNC 2348 */ 2349 HWTEST_F(JSInspectorTest, InspectProgressTest004, TestSize.Level1) 2350 { 2351 NodeId nodeId = -1; 2352 std::string tag = "tagTest"; 2353 InspectProgress inspectProgress(nodeId, tag); 2354 auto attrsSize = inspectProgress.attrs_.size(); 2355 auto stylesSize = inspectProgress.styles_.size(); 2356 2357 DeviceType deviceType = SystemProperties::GetDeviceType(); 2358 SystemProperties::SetDeviceType(DeviceType::WATCH); 2359 inspectProgress.PackAttrAndStyle(); 2360 CheckProgressAttrAndStyle(inspectProgress, attrsSize, stylesSize); 2361 SystemProperties::SetDeviceType(deviceType); 2362 } 2363 2364 /** 2365 * @tc.name: InspectProgressTest005 2366 * @tc.desc: InspectProgress::PackAttrAndStyle-CAR 2367 * @tc.type: FUNC 2368 */ 2369 HWTEST_F(JSInspectorTest, InspectProgressTest005, TestSize.Level1) 2370 { 2371 NodeId nodeId = -1; 2372 std::string tag = "tagTest"; 2373 InspectProgress inspectProgress(nodeId, tag); 2374 auto attrsSize = inspectProgress.attrs_.size(); 2375 auto stylesSize = inspectProgress.styles_.size(); 2376 2377 DeviceType deviceType = SystemProperties::GetDeviceType(); 2378 SystemProperties::SetDeviceType(DeviceType::CAR); 2379 inspectProgress.PackAttrAndStyle(); 2380 CheckProgressAttrAndStyle(inspectProgress, attrsSize, stylesSize); 2381 SystemProperties::SetDeviceType(deviceType); 2382 } 2383 2384 /** 2385 * @tc.name: InspectProgressTest006 2386 * @tc.desc: InspectProgress::PackAttrAndStyle-TABLET 2387 * @tc.type: FUNC 2388 */ 2389 HWTEST_F(JSInspectorTest, InspectProgressTest006, TestSize.Level1) 2390 { 2391 NodeId nodeId = -1; 2392 std::string tag = "tagTest"; 2393 InspectProgress inspectProgress(nodeId, tag); 2394 auto attrsSize = inspectProgress.attrs_.size(); 2395 auto stylesSize = inspectProgress.styles_.size(); 2396 2397 DeviceType deviceType = SystemProperties::GetDeviceType(); 2398 SystemProperties::SetDeviceType(DeviceType::TABLET); 2399 inspectProgress.PackAttrAndStyle(); 2400 CheckProgressAttrAndStyle(inspectProgress, attrsSize, stylesSize); 2401 SystemProperties::SetDeviceType(deviceType); 2402 } 2403 2404 /** 2405 * @tc.name: InspectProgressTest007 2406 * @tc.desc: InspectProgress::PackAttrAndStyle-UNKNOWN 2407 * @tc.type: FUNC 2408 */ 2409 HWTEST_F(JSInspectorTest, InspectProgressTest007, TestSize.Level1) 2410 { 2411 NodeId nodeId = -1; 2412 std::string tag = "tagTest"; 2413 InspectProgress inspectProgress(nodeId, tag); 2414 auto attrsSize = inspectProgress.attrs_.size(); 2415 auto stylesSize = inspectProgress.styles_.size(); 2416 2417 DeviceType deviceType = SystemProperties::GetDeviceType(); 2418 SystemProperties::SetDeviceType(DeviceType::UNKNOWN); 2419 inspectProgress.PackAttrAndStyle(); 2420 CheckProgressAttrAndStyle(inspectProgress, attrsSize, stylesSize); 2421 SystemProperties::SetDeviceType(deviceType); 2422 } 2423 2424 /** 2425 * @tc.name: InspectQRcodeTest001 2426 * @tc.desc: InspectQRcode::InspectQRcode 2427 * @tc.type: FUNC 2428 */ 2429 HWTEST_F(JSInspectorTest, InspectQRcodeTest001, TestSize.Level1) 2430 { 2431 NodeId nodeId = -1; 2432 std::string tag = "tagTest"; 2433 InspectQRcode inspectQRcode(nodeId, tag); 2434 EXPECT_EQ(inspectQRcode.nodeId_, nodeId); 2435 EXPECT_EQ(inspectQRcode.tag_, tag); 2436 } 2437 2438 /** 2439 * @tc.name: InspectQRcodeTest002 2440 * @tc.desc: InspectQRcode::PackAttrAndStyle 2441 * @tc.type: FUNC 2442 */ 2443 HWTEST_F(JSInspectorTest, InspectQRcodeTest002, TestSize.Level1) 2444 { 2445 NodeId nodeId = -1; 2446 std::string tag = "tagTest"; 2447 InspectQRcode inspectQRcode(nodeId, tag); 2448 auto attrsSize = inspectQRcode.attrs_.size(); 2449 auto stylesSize = inspectQRcode.styles_.size(); 2450 uint16_t attrsSizeInsert = 3; 2451 uint16_t stylesSizeInsert = 2; 2452 2453 inspectQRcode.PackAttrAndStyle(); 2454 EXPECT_EQ(inspectQRcode.attrs_.size(), attrsSize + attrsSizeInsert); 2455 EXPECT_EQ(inspectQRcode.attrs_["type"], "rect"); 2456 EXPECT_EQ(inspectQRcode.attrs_["disabled"], "false"); 2457 EXPECT_EQ(inspectQRcode.attrs_["focusable"], "false"); 2458 EXPECT_EQ(inspectQRcode.styles_.size(), stylesSize + stylesSizeInsert); 2459 EXPECT_EQ(inspectQRcode.styles_["color"], "#000000"); 2460 EXPECT_EQ(inspectQRcode.styles_["background-color"], "#ffffff"); 2461 } 2462 2463 /** 2464 * @tc.name: InspectRatingTest001 2465 * @tc.desc: InspectRating::InspectRating 2466 * @tc.type: FUNC 2467 */ 2468 HWTEST_F(JSInspectorTest, InspectRatingTest001, TestSize.Level1) 2469 { 2470 NodeId nodeId = -1; 2471 std::string tag = "tagTest"; 2472 InspectRating inspectRating(nodeId, tag); 2473 EXPECT_EQ(inspectRating.nodeId_, nodeId); 2474 EXPECT_EQ(inspectRating.tag_, tag); 2475 } 2476 2477 /** 2478 * @tc.name: InspectRatingTest002 2479 * @tc.desc: InspectRating::PackAttrAndStyle-PHONE 2480 * @tc.type: FUNC 2481 */ 2482 HWTEST_F(JSInspectorTest, InspectRatingTest002, TestSize.Level1) 2483 { 2484 NodeId nodeId = -1; 2485 std::string tag = "tagTest"; 2486 InspectRating inspectRating(nodeId, tag); 2487 auto attrsSize = inspectRating.attrs_.size(); 2488 auto stylesSize = inspectRating.styles_.size(); 2489 2490 DeviceType deviceType = SystemProperties::GetDeviceType(); 2491 SystemProperties::SetDeviceType(DeviceType::PHONE); 2492 inspectRating.PackAttrAndStyle(); 2493 CheckRatingAttrAndStyle(inspectRating, attrsSize, stylesSize); 2494 SystemProperties::SetDeviceType(deviceType); 2495 } 2496 2497 /** 2498 * @tc.name: InspectRatingTest003 2499 * @tc.desc: InspectRating::PackAttrAndStyle-TV 2500 * @tc.type: FUNC 2501 */ 2502 HWTEST_F(JSInspectorTest, InspectRatingTest003, TestSize.Level1) 2503 { 2504 NodeId nodeId = -1; 2505 std::string tag = "tagTest"; 2506 InspectRating inspectRating(nodeId, tag); 2507 auto attrsSize = inspectRating.attrs_.size(); 2508 auto stylesSize = inspectRating.styles_.size(); 2509 2510 DeviceType deviceType = SystemProperties::GetDeviceType(); 2511 SystemProperties::SetDeviceType(DeviceType::TV); 2512 inspectRating.PackAttrAndStyle(); 2513 CheckRatingAttrAndStyle(inspectRating, attrsSize, stylesSize); 2514 SystemProperties::SetDeviceType(deviceType); 2515 } 2516 2517 /** 2518 * @tc.name: InspectRatingTest004 2519 * @tc.desc: InspectRating::PackAttrAndStyle-WATCH 2520 * @tc.type: FUNC 2521 */ 2522 HWTEST_F(JSInspectorTest, InspectRatingTest004, TestSize.Level1) 2523 { 2524 NodeId nodeId = -1; 2525 std::string tag = "tagTest"; 2526 InspectRating inspectRating(nodeId, tag); 2527 auto attrsSize = inspectRating.attrs_.size(); 2528 auto stylesSize = inspectRating.styles_.size(); 2529 2530 DeviceType deviceType = SystemProperties::GetDeviceType(); 2531 SystemProperties::SetDeviceType(DeviceType::WATCH); 2532 inspectRating.PackAttrAndStyle(); 2533 CheckRatingAttrAndStyle(inspectRating, attrsSize, stylesSize); 2534 SystemProperties::SetDeviceType(deviceType); 2535 } 2536 2537 /** 2538 * @tc.name: InspectRatingTest005 2539 * @tc.desc: InspectRating::PackAttrAndStyle-CAR 2540 * @tc.type: FUNC 2541 */ 2542 HWTEST_F(JSInspectorTest, InspectRatingTest005, TestSize.Level1) 2543 { 2544 NodeId nodeId = -1; 2545 std::string tag = "tagTest"; 2546 InspectRating inspectRating(nodeId, tag); 2547 auto attrsSize = inspectRating.attrs_.size(); 2548 auto stylesSize = inspectRating.styles_.size(); 2549 2550 DeviceType deviceType = SystemProperties::GetDeviceType(); 2551 SystemProperties::SetDeviceType(DeviceType::CAR); 2552 inspectRating.PackAttrAndStyle(); 2553 CheckRatingAttrAndStyle(inspectRating, attrsSize, stylesSize); 2554 SystemProperties::SetDeviceType(deviceType); 2555 } 2556 2557 /** 2558 * @tc.name: InspectRatingTest006 2559 * @tc.desc: InspectRating::PackAttrAndStyle-TABLET 2560 * @tc.type: FUNC 2561 */ 2562 HWTEST_F(JSInspectorTest, InspectRatingTest006, TestSize.Level1) 2563 { 2564 NodeId nodeId = -1; 2565 std::string tag = "tagTest"; 2566 InspectRating inspectRating(nodeId, tag); 2567 auto attrsSize = inspectRating.attrs_.size(); 2568 auto stylesSize = inspectRating.styles_.size(); 2569 2570 DeviceType deviceType = SystemProperties::GetDeviceType(); 2571 SystemProperties::SetDeviceType(DeviceType::TABLET); 2572 inspectRating.PackAttrAndStyle(); 2573 CheckRatingAttrAndStyle(inspectRating, attrsSize, stylesSize); 2574 SystemProperties::SetDeviceType(deviceType); 2575 } 2576 2577 /** 2578 * @tc.name: InspectRatingTest007 2579 * @tc.desc: InspectRating::PackAttrAndStyle-UNKNOWN 2580 * @tc.type: FUNC 2581 */ 2582 HWTEST_F(JSInspectorTest, InspectRatingTest007, TestSize.Level1) 2583 { 2584 NodeId nodeId = -1; 2585 std::string tag = "tagTest"; 2586 InspectRating inspectRating(nodeId, tag); 2587 auto attrsSize = inspectRating.attrs_.size(); 2588 auto stylesSize = inspectRating.styles_.size(); 2589 2590 DeviceType deviceType = SystemProperties::GetDeviceType(); 2591 SystemProperties::SetDeviceType(DeviceType::UNKNOWN); 2592 inspectRating.PackAttrAndStyle(); 2593 CheckRatingAttrAndStyle(inspectRating, attrsSize, stylesSize); 2594 SystemProperties::SetDeviceType(deviceType); 2595 } 2596 2597 /** 2598 * @tc.name: InspectRefreshTest001 2599 * @tc.desc: InspectRefresh::InspectRefresh 2600 * @tc.type: FUNC 2601 */ 2602 HWTEST_F(JSInspectorTest, InspectRefreshTest001, TestSize.Level1) 2603 { 2604 NodeId nodeId = -1; 2605 std::string tag = "tagTest"; 2606 InspectRefresh inspectRefresh(nodeId, tag); 2607 EXPECT_EQ(inspectRefresh.nodeId_, nodeId); 2608 EXPECT_EQ(inspectRefresh.tag_, tag); 2609 } 2610 2611 /** 2612 * @tc.name: InspectRefreshTest002 2613 * @tc.desc: InspectRefresh::PackAttrAndStyle-PHONE 2614 * @tc.type: FUNC 2615 */ 2616 HWTEST_F(JSInspectorTest, InspectRefreshTest002, TestSize.Level1) 2617 { 2618 NodeId nodeId = -1; 2619 std::string tag = "tagTest"; 2620 InspectRefresh inspectRefresh(nodeId, tag); 2621 auto attrsSize = inspectRefresh.attrs_.size(); 2622 auto stylesSize = inspectRefresh.styles_.size(); 2623 2624 DeviceType deviceType = SystemProperties::GetDeviceType(); 2625 SystemProperties::SetDeviceType(DeviceType::PHONE); 2626 inspectRefresh.PackAttrAndStyle(); 2627 CheckRefreshAttrAndStyle(inspectRefresh, attrsSize, stylesSize); 2628 SystemProperties::SetDeviceType(deviceType); 2629 } 2630 2631 /** 2632 * @tc.name: InspectRefreshTest003 2633 * @tc.desc: InspectRefresh::PackAttrAndStyle-TV 2634 * @tc.type: FUNC 2635 */ 2636 HWTEST_F(JSInspectorTest, InspectRefreshTest003, TestSize.Level1) 2637 { 2638 NodeId nodeId = -1; 2639 std::string tag = "tagTest"; 2640 InspectRefresh inspectRefresh(nodeId, tag); 2641 auto attrsSize = inspectRefresh.attrs_.size(); 2642 auto stylesSize = inspectRefresh.styles_.size(); 2643 2644 DeviceType deviceType = SystemProperties::GetDeviceType(); 2645 SystemProperties::SetDeviceType(DeviceType::TV); 2646 inspectRefresh.PackAttrAndStyle(); 2647 CheckRefreshAttrAndStyle(inspectRefresh, attrsSize, stylesSize); 2648 SystemProperties::SetDeviceType(deviceType); 2649 } 2650 2651 /** 2652 * @tc.name: InspectRefreshTest004 2653 * @tc.desc: InspectRefresh::PackAttrAndStyle-WATCH 2654 * @tc.type: FUNC 2655 */ 2656 HWTEST_F(JSInspectorTest, InspectRefreshTest004, TestSize.Level1) 2657 { 2658 NodeId nodeId = -1; 2659 std::string tag = "tagTest"; 2660 InspectRefresh inspectRefresh(nodeId, tag); 2661 auto attrsSize = inspectRefresh.attrs_.size(); 2662 auto stylesSize = inspectRefresh.styles_.size(); 2663 2664 DeviceType deviceType = SystemProperties::GetDeviceType(); 2665 SystemProperties::SetDeviceType(DeviceType::WATCH); 2666 inspectRefresh.PackAttrAndStyle(); 2667 CheckRefreshAttrAndStyle(inspectRefresh, attrsSize, stylesSize); 2668 SystemProperties::SetDeviceType(deviceType); 2669 } 2670 2671 /** 2672 * @tc.name: InspectRefreshTest005 2673 * @tc.desc: InspectRefresh::PackAttrAndStyle-CAR 2674 * @tc.type: FUNC 2675 */ 2676 HWTEST_F(JSInspectorTest, InspectRefreshTest005, TestSize.Level1) 2677 { 2678 NodeId nodeId = -1; 2679 std::string tag = "tagTest"; 2680 InspectRefresh inspectRefresh(nodeId, tag); 2681 auto attrsSize = inspectRefresh.attrs_.size(); 2682 auto stylesSize = inspectRefresh.styles_.size(); 2683 2684 DeviceType deviceType = SystemProperties::GetDeviceType(); 2685 SystemProperties::SetDeviceType(DeviceType::CAR); 2686 inspectRefresh.PackAttrAndStyle(); 2687 CheckRefreshAttrAndStyle(inspectRefresh, attrsSize, stylesSize); 2688 SystemProperties::SetDeviceType(deviceType); 2689 } 2690 2691 /** 2692 * @tc.name: InspectRefreshTest006 2693 * @tc.desc: InspectRefresh::PackAttrAndStyle-TABLET 2694 * @tc.type: FUNC 2695 */ 2696 HWTEST_F(JSInspectorTest, InspectRefreshTest006, TestSize.Level1) 2697 { 2698 NodeId nodeId = -1; 2699 std::string tag = "tagTest"; 2700 InspectRefresh inspectRefresh(nodeId, tag); 2701 auto attrsSize = inspectRefresh.attrs_.size(); 2702 auto stylesSize = inspectRefresh.styles_.size(); 2703 2704 DeviceType deviceType = SystemProperties::GetDeviceType(); 2705 SystemProperties::SetDeviceType(DeviceType::TABLET); 2706 inspectRefresh.PackAttrAndStyle(); 2707 CheckRefreshAttrAndStyle(inspectRefresh, attrsSize, stylesSize); 2708 SystemProperties::SetDeviceType(deviceType); 2709 } 2710 2711 /** 2712 * @tc.name: InspectRefreshTest007 2713 * @tc.desc: InspectRefresh::PackAttrAndStyle-UNKNOWN 2714 * @tc.type: FUNC 2715 */ 2716 HWTEST_F(JSInspectorTest, InspectRefreshTest007, TestSize.Level1) 2717 { 2718 NodeId nodeId = -1; 2719 std::string tag = "tagTest"; 2720 InspectRefresh inspectRefresh(nodeId, tag); 2721 auto attrsSize = inspectRefresh.attrs_.size(); 2722 auto stylesSize = inspectRefresh.styles_.size(); 2723 2724 DeviceType deviceType = SystemProperties::GetDeviceType(); 2725 SystemProperties::SetDeviceType(DeviceType::UNKNOWN); 2726 inspectRefresh.PackAttrAndStyle(); 2727 CheckRefreshAttrAndStyle(inspectRefresh, attrsSize, stylesSize); 2728 SystemProperties::SetDeviceType(deviceType); 2729 } 2730 2731 /** 2732 * @tc.name: InspectSearchTest001 2733 * @tc.desc: InspectSearch::InspectSearch 2734 * @tc.type: FUNC 2735 */ 2736 HWTEST_F(JSInspectorTest, InspectSearchTest001, TestSize.Level1) 2737 { 2738 NodeId nodeId = -1; 2739 std::string tag = "tagTest"; 2740 InspectSearch inspectSearch(nodeId, tag); 2741 EXPECT_EQ(inspectSearch.nodeId_, nodeId); 2742 EXPECT_EQ(inspectSearch.tag_, tag); 2743 } 2744 2745 /** 2746 * @tc.name: InspectSearchTest002 2747 * @tc.desc: InspectSearch::PackAttrAndStyle 2748 * @tc.type: FUNC 2749 */ 2750 HWTEST_F(JSInspectorTest, InspectSearchTest002, TestSize.Level1) 2751 { 2752 NodeId nodeId = -1; 2753 std::string tag = "tagTest"; 2754 InspectSearch inspectSearch(nodeId, tag); 2755 auto attrsSize = inspectSearch.attrs_.size(); 2756 auto stylesSize = inspectSearch.styles_.size(); 2757 uint16_t attrsSizeInsert = 2; 2758 uint16_t stylesSizeInsert = 3; 2759 2760 inspectSearch.PackAttrAndStyle(); 2761 EXPECT_EQ(inspectSearch.attrs_.size(), attrsSize + attrsSizeInsert); 2762 EXPECT_EQ(inspectSearch.attrs_["disabled"], "false"); 2763 EXPECT_EQ(inspectSearch.attrs_["focusable"], "true"); 2764 EXPECT_EQ(inspectSearch.styles_.size(), stylesSize + stylesSizeInsert); 2765 EXPECT_EQ(inspectSearch.styles_["allow-scale"], "true"); 2766 EXPECT_EQ(inspectSearch.styles_["font-weight"], "normal"); 2767 EXPECT_EQ(inspectSearch.styles_["font-family"], "sans-serif"); 2768 } 2769 2770 /** 2771 * @tc.name: InspectSelectTest001 2772 * @tc.desc: InspectSelect::InspectSelect 2773 * @tc.type: FUNC 2774 */ 2775 HWTEST_F(JSInspectorTest, InspectSelectTest001, TestSize.Level1) 2776 { 2777 NodeId nodeId = -1; 2778 std::string tag = "tagTest"; 2779 InspectSelect inspectSelect(nodeId, tag); 2780 EXPECT_EQ(inspectSelect.nodeId_, nodeId); 2781 EXPECT_EQ(inspectSelect.tag_, tag); 2782 } 2783 2784 /** 2785 * @tc.name: InspectSelectTest002 2786 * @tc.desc: InspectSelect::PackAttrAndStyle 2787 * @tc.type: FUNC 2788 */ 2789 HWTEST_F(JSInspectorTest, InspectSelectTest002, TestSize.Level1) 2790 { 2791 NodeId nodeId = -1; 2792 std::string tag = "tagTest"; 2793 InspectSelect inspectSelect(nodeId, tag); 2794 auto attrsSize = inspectSelect.attrs_.size(); 2795 auto stylesSize = inspectSelect.styles_.size(); 2796 uint16_t attrsSizeInsert = 2; 2797 uint16_t stylesSizeInsert = 1; 2798 2799 inspectSelect.PackAttrAndStyle(); 2800 EXPECT_EQ(inspectSelect.attrs_.size(), attrsSize + attrsSizeInsert); 2801 EXPECT_EQ(inspectSelect.attrs_["disabled"], "false"); 2802 EXPECT_EQ(inspectSelect.attrs_["focusable"], "true"); 2803 EXPECT_EQ(inspectSelect.styles_.size(), stylesSize + stylesSizeInsert); 2804 EXPECT_EQ(inspectSelect.styles_["font-family"], "sans-serif"); 2805 } 2806 2807 /** 2808 * @tc.name: InspectSliderTest001 2809 * @tc.desc: InspectSlider::InspectSlider 2810 * @tc.type: FUNC 2811 */ 2812 HWTEST_F(JSInspectorTest, InspectSliderTest001, TestSize.Level1) 2813 { 2814 NodeId nodeId = -1; 2815 std::string tag = "tagTest"; 2816 InspectSlider inspectSlider(nodeId, tag); 2817 EXPECT_EQ(inspectSlider.nodeId_, nodeId); 2818 EXPECT_EQ(inspectSlider.tag_, tag); 2819 } 2820 2821 /** 2822 * @tc.name: InspectSliderTest002 2823 * @tc.desc: InspectSlider::PackAttrAndStyle-PHONE 2824 * @tc.type: FUNC 2825 */ 2826 HWTEST_F(JSInspectorTest, InspectSliderTest002, TestSize.Level1) 2827 { 2828 NodeId nodeId = -1; 2829 std::string tag = "tagTest"; 2830 InspectSlider inspectSlider(nodeId, tag); 2831 auto attrsSize = inspectSlider.attrs_.size(); 2832 auto stylesSize = inspectSlider.styles_.size(); 2833 2834 DeviceType deviceType = SystemProperties::GetDeviceType(); 2835 SystemProperties::SetDeviceType(DeviceType::PHONE); 2836 inspectSlider.PackAttrAndStyle(); 2837 CheckSliderAttrAndStyle(inspectSlider, attrsSize, stylesSize); 2838 SystemProperties::SetDeviceType(deviceType); 2839 } 2840 2841 /** 2842 * @tc.name: InspectSliderTest003 2843 * @tc.desc: InspectSlider::PackAttrAndStyle-TV 2844 * @tc.type: FUNC 2845 */ 2846 HWTEST_F(JSInspectorTest, InspectSliderTest003, TestSize.Level1) 2847 { 2848 NodeId nodeId = -1; 2849 std::string tag = "tagTest"; 2850 InspectSlider inspectSlider(nodeId, tag); 2851 auto attrsSize = inspectSlider.attrs_.size(); 2852 auto stylesSize = inspectSlider.styles_.size(); 2853 2854 DeviceType deviceType = SystemProperties::GetDeviceType(); 2855 SystemProperties::SetDeviceType(DeviceType::TV); 2856 inspectSlider.PackAttrAndStyle(); 2857 CheckSliderAttrAndStyle(inspectSlider, attrsSize, stylesSize); 2858 SystemProperties::SetDeviceType(deviceType); 2859 } 2860 2861 /** 2862 * @tc.name: InspectSliderTest004 2863 * @tc.desc: InspectSlider::PackAttrAndStyle-WATCH 2864 * @tc.type: FUNC 2865 */ 2866 HWTEST_F(JSInspectorTest, InspectSliderTest004, TestSize.Level1) 2867 { 2868 NodeId nodeId = -1; 2869 std::string tag = "tagTest"; 2870 InspectSlider inspectSlider(nodeId, tag); 2871 auto attrsSize = inspectSlider.attrs_.size(); 2872 auto stylesSize = inspectSlider.styles_.size(); 2873 2874 DeviceType deviceType = SystemProperties::GetDeviceType(); 2875 SystemProperties::SetDeviceType(DeviceType::WATCH); 2876 inspectSlider.PackAttrAndStyle(); 2877 CheckSliderAttrAndStyle(inspectSlider, attrsSize, stylesSize); 2878 SystemProperties::SetDeviceType(deviceType); 2879 } 2880 2881 /** 2882 * @tc.name: InspectSliderTest005 2883 * @tc.desc: InspectSlider::PackAttrAndStyle-CAR 2884 * @tc.type: FUNC 2885 */ 2886 HWTEST_F(JSInspectorTest, InspectSliderTest005, TestSize.Level1) 2887 { 2888 NodeId nodeId = -1; 2889 std::string tag = "tagTest"; 2890 InspectSlider inspectSlider(nodeId, tag); 2891 auto attrsSize = inspectSlider.attrs_.size(); 2892 auto stylesSize = inspectSlider.styles_.size(); 2893 2894 DeviceType deviceType = SystemProperties::GetDeviceType(); 2895 SystemProperties::SetDeviceType(DeviceType::CAR); 2896 inspectSlider.PackAttrAndStyle(); 2897 CheckSliderAttrAndStyle(inspectSlider, attrsSize, stylesSize); 2898 SystemProperties::SetDeviceType(deviceType); 2899 } 2900 2901 /** 2902 * @tc.name: InspectSliderTest006 2903 * @tc.desc: InspectSlider::PackAttrAndStyle-TABLET 2904 * @tc.type: FUNC 2905 */ 2906 HWTEST_F(JSInspectorTest, InspectSliderTest006, TestSize.Level1) 2907 { 2908 NodeId nodeId = -1; 2909 std::string tag = "tagTest"; 2910 InspectSlider inspectSlider(nodeId, tag); 2911 auto attrsSize = inspectSlider.attrs_.size(); 2912 auto stylesSize = inspectSlider.styles_.size(); 2913 2914 DeviceType deviceType = SystemProperties::GetDeviceType(); 2915 SystemProperties::SetDeviceType(DeviceType::TABLET); 2916 inspectSlider.PackAttrAndStyle(); 2917 CheckSliderAttrAndStyle(inspectSlider, attrsSize, stylesSize); 2918 SystemProperties::SetDeviceType(deviceType); 2919 } 2920 2921 /** 2922 * @tc.name: InspectSliderTest007 2923 * @tc.desc: InspectSlider::PackAttrAndStyle-UNKNOWN 2924 * @tc.type: FUNC 2925 */ 2926 HWTEST_F(JSInspectorTest, InspectSliderTest007, TestSize.Level1) 2927 { 2928 NodeId nodeId = -1; 2929 std::string tag = "tagTest"; 2930 InspectSlider inspectSlider(nodeId, tag); 2931 auto attrsSize = inspectSlider.attrs_.size(); 2932 auto stylesSize = inspectSlider.styles_.size(); 2933 2934 DeviceType deviceType = SystemProperties::GetDeviceType(); 2935 SystemProperties::SetDeviceType(DeviceType::UNKNOWN); 2936 inspectSlider.PackAttrAndStyle(); 2937 CheckSliderAttrAndStyle(inspectSlider, attrsSize, stylesSize); 2938 SystemProperties::SetDeviceType(deviceType); 2939 } 2940 2941 /** 2942 * @tc.name: InspectSpanTest001 2943 * @tc.desc: InspectSpan::InspectSpan 2944 * @tc.type: FUNC 2945 */ 2946 HWTEST_F(JSInspectorTest, InspectSpanTest001, TestSize.Level1) 2947 { 2948 NodeId nodeId = -1; 2949 std::string tag = "tagTest"; 2950 InspectSpan inspectSpan(nodeId, tag); 2951 EXPECT_EQ(inspectSpan.nodeId_, nodeId); 2952 EXPECT_EQ(inspectSpan.tag_, tag); 2953 } 2954 2955 /** 2956 * @tc.name: InspectSpanTest002 2957 * @tc.desc: InspectSpan::PackAttrAndStyle 2958 * @tc.type: FUNC 2959 */ 2960 HWTEST_F(JSInspectorTest, InspectSpanTest002, TestSize.Level1) 2961 { 2962 NodeId nodeId = -1; 2963 std::string tag = "tagTest"; 2964 InspectSpan inspectSpan(nodeId, tag); 2965 auto attrsSize = inspectSpan.attrs_.size(); 2966 auto stylesSize = inspectSpan.styles_.size(); 2967 uint16_t stylesSizeInsert = 6; 2968 2969 inspectSpan.PackAttrAndStyle(); 2970 EXPECT_EQ(inspectSpan.attrs_.size(), attrsSize); 2971 EXPECT_EQ(inspectSpan.styles_.size(), stylesSize + stylesSizeInsert); 2972 EXPECT_EQ(inspectSpan.styles_["font-size"], "30px"); 2973 EXPECT_EQ(inspectSpan.styles_["allow-scale"], "true"); 2974 EXPECT_EQ(inspectSpan.styles_["font-style"], "normal"); 2975 EXPECT_EQ(inspectSpan.styles_["font-weight"], "normal"); 2976 EXPECT_EQ(inspectSpan.styles_["text-decoration"], "none"); 2977 EXPECT_EQ(inspectSpan.styles_["font-family"], "sans-serif"); 2978 } 2979 2980 /** 2981 * @tc.name: InspectStackTest001 2982 * @tc.desc: InspectStack::InspectStack 2983 * @tc.type: FUNC 2984 */ 2985 HWTEST_F(JSInspectorTest, InspectStackTest001, TestSize.Level1) 2986 { 2987 NodeId nodeId = -1; 2988 std::string tag = "tagTest"; 2989 InspectStack inspectStack(nodeId, tag); 2990 EXPECT_EQ(inspectStack.nodeId_, nodeId); 2991 EXPECT_EQ(inspectStack.tag_, tag); 2992 } 2993 2994 /** 2995 * @tc.name: InspectStackTest002 2996 * @tc.desc: InspectStack::PackAttrAndStyle 2997 * @tc.type: FUNC 2998 */ 2999 HWTEST_F(JSInspectorTest, InspectStackTest002, TestSize.Level1) 3000 { 3001 NodeId nodeId = -1; 3002 std::string tag = "tagTest"; 3003 InspectStack inspectStack(nodeId, tag); 3004 auto attrsSize = inspectStack.attrs_.size(); 3005 auto stylesSize = inspectStack.styles_.size(); 3006 uint16_t attrsSizeInsert = 2; 3007 3008 inspectStack.PackAttrAndStyle(); 3009 EXPECT_EQ(inspectStack.attrs_.size(), attrsSize + attrsSizeInsert); 3010 EXPECT_EQ(inspectStack.attrs_["disabled"], "false"); 3011 EXPECT_EQ(inspectStack.attrs_["focusable"], "true"); 3012 EXPECT_EQ(inspectStack.styles_.size(), stylesSize); 3013 } 3014 3015 /** 3016 * @tc.name: InspectStepperItemTest001 3017 * @tc.desc: InspectStepperItem::InspectStepperItem 3018 * @tc.type: FUNC 3019 */ 3020 HWTEST_F(JSInspectorTest, InspectStepperItemTest001, TestSize.Level1) 3021 { 3022 NodeId nodeId = -1; 3023 std::string tag = "tagTest"; 3024 InspectStepperItem inspectStepperItem(nodeId, tag); 3025 EXPECT_EQ(inspectStepperItem.nodeId_, nodeId); 3026 EXPECT_EQ(inspectStepperItem.tag_, tag); 3027 } 3028 3029 /** 3030 * @tc.name: InspectStepperItemTest002 3031 * @tc.desc: InspectStepperItem::PackAttrAndStyle 3032 * @tc.type: FUNC 3033 */ 3034 HWTEST_F(JSInspectorTest, InspectStepperItemTest002, TestSize.Level1) 3035 { 3036 NodeId nodeId = -1; 3037 std::string tag = "tagTest"; 3038 InspectStepperItem inspectStepperItem(nodeId, tag); 3039 auto attrsSize = inspectStepperItem.attrs_.size(); 3040 auto stylesSize = inspectStepperItem.styles_.size(); 3041 uint16_t attrsSizeInsert = 1; 3042 uint16_t stylesSizeInsert = 7; 3043 3044 inspectStepperItem.PackAttrAndStyle(); 3045 EXPECT_EQ(inspectStepperItem.attrs_.size(), attrsSize + attrsSizeInsert); 3046 EXPECT_EQ(inspectStepperItem.attrs_["disabled"], "false"); 3047 EXPECT_EQ(inspectStepperItem.styles_.size(), stylesSize + stylesSizeInsert); 3048 EXPECT_EQ(inspectStepperItem.styles_["color"], "#e600000"); 3049 EXPECT_EQ(inspectStepperItem.styles_["font-size"], "16px"); 3050 EXPECT_EQ(inspectStepperItem.styles_["allow-scale"], "true"); 3051 EXPECT_EQ(inspectStepperItem.styles_["font-style"], "normal"); 3052 EXPECT_EQ(inspectStepperItem.styles_["font-weight"], "normal"); 3053 EXPECT_EQ(inspectStepperItem.styles_["text-decoration"], "none"); 3054 EXPECT_EQ(inspectStepperItem.styles_["font-family"], "sans-serif"); 3055 EXPECT_EQ(inspectStepperItem.styles_.find("flex-grow"), inspectStepperItem.styles_.end()); 3056 EXPECT_EQ(inspectStepperItem.styles_.find("flex-shrink"), inspectStepperItem.styles_.end()); 3057 EXPECT_EQ(inspectStepperItem.styles_.find("position"), inspectStepperItem.styles_.end()); 3058 } 3059 3060 /** 3061 * @tc.name: InspectStepperTest001 3062 * @tc.desc: InspectStepper::InspectStepper 3063 * @tc.type: FUNC 3064 */ 3065 HWTEST_F(JSInspectorTest, InspectStepperTest001, TestSize.Level1) 3066 { 3067 NodeId nodeId = -1; 3068 std::string tag = "tagTest"; 3069 InspectStepper inspectStepper(nodeId, tag); 3070 EXPECT_EQ(inspectStepper.nodeId_, nodeId); 3071 EXPECT_EQ(inspectStepper.tag_, tag); 3072 } 3073 3074 /** 3075 * @tc.name: InspectStepperTest002 3076 * @tc.desc: InspectStepper::PackAttrAndStyle 3077 * @tc.type: FUNC 3078 */ 3079 HWTEST_F(JSInspectorTest, InspectStepperTest002, TestSize.Level1) 3080 { 3081 NodeId nodeId = -1; 3082 std::string tag = "tagTest"; 3083 InspectStepper inspectStepper(nodeId, tag); 3084 auto attrsSize = inspectStepper.attrs_.size(); 3085 auto stylesSize = inspectStepper.styles_.size(); 3086 uint16_t attrsSizeInsert = 2; 3087 3088 inspectStepper.PackAttrAndStyle(); 3089 EXPECT_EQ(inspectStepper.attrs_.size(), attrsSize + attrsSizeInsert); 3090 EXPECT_EQ(inspectStepper.attrs_["disabled"], "false"); 3091 EXPECT_EQ(inspectStepper.attrs_["focusable"], "false"); 3092 EXPECT_EQ(inspectStepper.styles_.size(), stylesSize); 3093 } 3094 3095 /** 3096 * @tc.name: InspectSwiperTest001 3097 * @tc.desc: InspectSwiper::InspectSwiper 3098 * @tc.type: FUNC 3099 */ 3100 HWTEST_F(JSInspectorTest, InspectSwiperTest001, TestSize.Level1) 3101 { 3102 NodeId nodeId = -1; 3103 std::string tag = "tagTest"; 3104 InspectSwiper inspectSwiper(nodeId, tag); 3105 EXPECT_EQ(inspectSwiper.nodeId_, nodeId); 3106 EXPECT_EQ(inspectSwiper.tag_, tag); 3107 } 3108 3109 /** 3110 * @tc.name: InspectSwiperTest002 3111 * @tc.desc: InspectSwiper::PackAttrAndStyle-PHONE 3112 * @tc.type: FUNC 3113 */ 3114 HWTEST_F(JSInspectorTest, InspectSwiperTest002, TestSize.Level1) 3115 { 3116 NodeId nodeId = -1; 3117 std::string tag = "tagTest"; 3118 InspectSwiper inspectSwiper(nodeId, tag); 3119 auto attrsSize = inspectSwiper.attrs_.size(); 3120 auto stylesSize = inspectSwiper.styles_.size(); 3121 3122 DeviceType deviceType = SystemProperties::GetDeviceType(); 3123 SystemProperties::SetDeviceType(DeviceType::PHONE); 3124 inspectSwiper.PackAttrAndStyle(); 3125 CheckSwiperAttrAndStyle(inspectSwiper, attrsSize, stylesSize); 3126 SystemProperties::SetDeviceType(deviceType); 3127 } 3128 3129 /** 3130 * @tc.name: InspectSwiperTest003 3131 * @tc.desc: InspectSwiper::PackAttrAndStyle-TV 3132 * @tc.type: FUNC 3133 */ 3134 HWTEST_F(JSInspectorTest, InspectSwiperTest003, TestSize.Level1) 3135 { 3136 NodeId nodeId = -1; 3137 std::string tag = "tagTest"; 3138 InspectSwiper inspectSwiper(nodeId, tag); 3139 auto attrsSize = inspectSwiper.attrs_.size(); 3140 auto stylesSize = inspectSwiper.styles_.size(); 3141 3142 DeviceType deviceType = SystemProperties::GetDeviceType(); 3143 SystemProperties::SetDeviceType(DeviceType::TV); 3144 inspectSwiper.PackAttrAndStyle(); 3145 CheckSwiperAttrAndStyle(inspectSwiper, attrsSize, stylesSize); 3146 SystemProperties::SetDeviceType(deviceType); 3147 } 3148 3149 /** 3150 * @tc.name: InspectSwiperTest004 3151 * @tc.desc: InspectSwiper::PackAttrAndStyle-WATCH 3152 * @tc.type: FUNC 3153 */ 3154 HWTEST_F(JSInspectorTest, InspectSwiperTest004, TestSize.Level1) 3155 { 3156 NodeId nodeId = -1; 3157 std::string tag = "tagTest"; 3158 InspectSwiper inspectSwiper(nodeId, tag); 3159 auto attrsSize = inspectSwiper.attrs_.size(); 3160 auto stylesSize = inspectSwiper.styles_.size(); 3161 3162 DeviceType deviceType = SystemProperties::GetDeviceType(); 3163 SystemProperties::SetDeviceType(DeviceType::WATCH); 3164 inspectSwiper.PackAttrAndStyle(); 3165 CheckSwiperAttrAndStyle(inspectSwiper, attrsSize, stylesSize); 3166 SystemProperties::SetDeviceType(deviceType); 3167 } 3168 3169 /** 3170 * @tc.name: InspectSwiperTest005 3171 * @tc.desc: InspectSwiper::PackAttrAndStyle-CAR 3172 * @tc.type: FUNC 3173 */ 3174 HWTEST_F(JSInspectorTest, InspectSwiperTest005, TestSize.Level1) 3175 { 3176 NodeId nodeId = -1; 3177 std::string tag = "tagTest"; 3178 InspectSwiper inspectSwiper(nodeId, tag); 3179 auto attrsSize = inspectSwiper.attrs_.size(); 3180 auto stylesSize = inspectSwiper.styles_.size(); 3181 3182 DeviceType deviceType = SystemProperties::GetDeviceType(); 3183 SystemProperties::SetDeviceType(DeviceType::CAR); 3184 inspectSwiper.PackAttrAndStyle(); 3185 CheckSwiperAttrAndStyle(inspectSwiper, attrsSize, stylesSize); 3186 SystemProperties::SetDeviceType(deviceType); 3187 } 3188 3189 /** 3190 * @tc.name: InspectSwiperTest006 3191 * @tc.desc: InspectSwiper::PackAttrAndStyle-TABLET 3192 * @tc.type: FUNC 3193 */ 3194 HWTEST_F(JSInspectorTest, InspectSwiperTest006, TestSize.Level1) 3195 { 3196 NodeId nodeId = -1; 3197 std::string tag = "tagTest"; 3198 InspectSwiper inspectSwiper(nodeId, tag); 3199 auto attrsSize = inspectSwiper.attrs_.size(); 3200 auto stylesSize = inspectSwiper.styles_.size(); 3201 3202 DeviceType deviceType = SystemProperties::GetDeviceType(); 3203 SystemProperties::SetDeviceType(DeviceType::TABLET); 3204 inspectSwiper.PackAttrAndStyle(); 3205 CheckSwiperAttrAndStyle(inspectSwiper, attrsSize, stylesSize); 3206 SystemProperties::SetDeviceType(deviceType); 3207 } 3208 3209 /** 3210 * @tc.name: InspectSwiperTest007 3211 * @tc.desc: InspectSwiper::PackAttrAndStyle-UNKNOWN 3212 * @tc.type: FUNC 3213 */ 3214 HWTEST_F(JSInspectorTest, InspectSwiperTest007, TestSize.Level1) 3215 { 3216 NodeId nodeId = -1; 3217 std::string tag = "tagTest"; 3218 InspectSwiper inspectSwiper(nodeId, tag); 3219 auto attrsSize = inspectSwiper.attrs_.size(); 3220 auto stylesSize = inspectSwiper.styles_.size(); 3221 3222 DeviceType deviceType = SystemProperties::GetDeviceType(); 3223 SystemProperties::SetDeviceType(DeviceType::UNKNOWN); 3224 inspectSwiper.PackAttrAndStyle(); 3225 CheckSwiperAttrAndStyle(inspectSwiper, attrsSize, stylesSize); 3226 SystemProperties::SetDeviceType(deviceType); 3227 } 3228 3229 /** 3230 * @tc.name: InspectSwitchTest001 3231 * @tc.desc: InspectSwitch::InspectSwitch 3232 * @tc.type: FUNC 3233 */ 3234 HWTEST_F(JSInspectorTest, InspectSwitchTest001, TestSize.Level1) 3235 { 3236 NodeId nodeId = -1; 3237 std::string tag = "tagTest"; 3238 InspectSwitch inspectSwitch(nodeId, tag); 3239 EXPECT_EQ(inspectSwitch.nodeId_, nodeId); 3240 EXPECT_EQ(inspectSwitch.tag_, tag); 3241 } 3242 3243 /** 3244 * @tc.name: InspectSwitchTest002 3245 * @tc.desc: InspectSwitch::PackAttrAndStyle 3246 * @tc.type: FUNC 3247 */ 3248 HWTEST_F(JSInspectorTest, InspectSwitchTest002, TestSize.Level1) 3249 { 3250 NodeId nodeId = -1; 3251 std::string tag = "tagTest"; 3252 InspectSwitch inspectSwitch(nodeId, tag); 3253 auto attrsSize = inspectSwitch.attrs_.size(); 3254 auto stylesSize = inspectSwitch.styles_.size(); 3255 uint16_t attrsSizeInsert = 6; 3256 uint16_t stylesSizeInsert = 7; 3257 3258 inspectSwitch.PackAttrAndStyle(); 3259 EXPECT_EQ(inspectSwitch.attrs_.size(), attrsSize + attrsSizeInsert); 3260 EXPECT_EQ(inspectSwitch.attrs_["checked"], "false"); 3261 EXPECT_EQ(inspectSwitch.attrs_["showtext"], "false"); 3262 EXPECT_EQ(inspectSwitch.attrs_["texton"], "On"); 3263 EXPECT_EQ(inspectSwitch.attrs_["textoff"], "Off"); 3264 EXPECT_EQ(inspectSwitch.attrs_["disabled"], "false"); 3265 EXPECT_EQ(inspectSwitch.attrs_["focusable"], "true"); 3266 EXPECT_EQ(inspectSwitch.styles_.size(), stylesSize + stylesSizeInsert); 3267 EXPECT_EQ(inspectSwitch.styles_["texton-color"], "#000000"); 3268 EXPECT_EQ(inspectSwitch.styles_["textoff-color"], "#000000"); 3269 EXPECT_EQ(inspectSwitch.styles_["text-padding"], "0px"); 3270 EXPECT_EQ(inspectSwitch.styles_["allow-scale"], "true"); 3271 EXPECT_EQ(inspectSwitch.styles_["font-style"], "normal"); 3272 EXPECT_EQ(inspectSwitch.styles_["font-weight"], "normal"); 3273 EXPECT_EQ(inspectSwitch.styles_["font-family"], "sans-serif"); 3274 } 3275 3276 /** 3277 * @tc.name: InspectTabBarTest001 3278 * @tc.desc: InspectTabBar::InspectTabBar 3279 * @tc.type: FUNC 3280 */ 3281 HWTEST_F(JSInspectorTest, InspectTabBarTest001, TestSize.Level1) 3282 { 3283 NodeId nodeId = -1; 3284 std::string tag = "tagTest"; 3285 InspectTabBar inspectTabBar(nodeId, tag); 3286 EXPECT_EQ(inspectTabBar.nodeId_, nodeId); 3287 EXPECT_EQ(inspectTabBar.tag_, tag); 3288 } 3289 3290 /** 3291 * @tc.name: InspectTabBarTest002 3292 * @tc.desc: InspectTabBar::PackAttrAndStyle 3293 * @tc.type: FUNC 3294 */ 3295 HWTEST_F(JSInspectorTest, InspectTabBarTest002, TestSize.Level1) 3296 { 3297 NodeId nodeId = -1; 3298 std::string tag = "tagTest"; 3299 uint16_t typeNum = 6; 3300 DeviceType deviceType = SystemProperties::GetDeviceType(); 3301 for (uint16_t i = 0; i < typeNum; i++) { 3302 InspectTabBar inspectTabBar(nodeId, tag); 3303 auto attrsSize = inspectTabBar.attrs_.size(); 3304 auto stylesSize = inspectTabBar.styles_.size(); 3305 SystemProperties::SetDeviceType(static_cast<DeviceType>(i)); 3306 inspectTabBar.PackAttrAndStyle(); 3307 CheckTabBarAttrAndStyle(inspectTabBar, attrsSize, stylesSize); 3308 } 3309 SystemProperties::SetDeviceType(deviceType); 3310 } 3311 3312 /** 3313 * @tc.name: InspectTabContentTest001 3314 * @tc.desc: InspectTabContent::InspectTabContent 3315 * @tc.type: FUNC 3316 */ 3317 HWTEST_F(JSInspectorTest, InspectTabContentTest001, TestSize.Level1) 3318 { 3319 NodeId nodeId = -1; 3320 std::string tag = "tagTest"; 3321 InspectTabContent inspectTabContent(nodeId, tag); 3322 EXPECT_EQ(inspectTabContent.nodeId_, nodeId); 3323 EXPECT_EQ(inspectTabContent.tag_, tag); 3324 } 3325 3326 /** 3327 * @tc.name: InspectTabContentTest002 3328 * @tc.desc: InspectTabContent::PackAttrAndStyle 3329 * @tc.type: FUNC 3330 */ 3331 HWTEST_F(JSInspectorTest, InspectTabContentTest002, TestSize.Level1) 3332 { 3333 NodeId nodeId = -1; 3334 std::string tag = "tagTest"; 3335 InspectTabContent inspectTabContent(nodeId, tag); 3336 auto attrsSize = inspectTabContent.attrs_.size(); 3337 auto stylesSize = inspectTabContent.styles_.size(); 3338 uint16_t attrsSizeInsert = 3; 3339 3340 inspectTabContent.PackAttrAndStyle(); 3341 EXPECT_EQ(inspectTabContent.attrs_.size(), attrsSize + attrsSizeInsert); 3342 EXPECT_EQ(inspectTabContent.attrs_["scrollable"], "true"); 3343 EXPECT_EQ(inspectTabContent.attrs_["disabled"], "false"); 3344 EXPECT_EQ(inspectTabContent.attrs_["focusable"], "true"); 3345 EXPECT_EQ(inspectTabContent.styles_.size(), stylesSize); 3346 } 3347 3348 /** 3349 * @tc.name: InspectTabsTest001 3350 * @tc.desc: InspectTabs::InspectTabs 3351 * @tc.type: FUNC 3352 */ 3353 HWTEST_F(JSInspectorTest, InspectTabsTest001, TestSize.Level1) 3354 { 3355 NodeId nodeId = -1; 3356 std::string tag = "tagTest"; 3357 InspectTabs inspectTabs(nodeId, tag); 3358 EXPECT_EQ(inspectTabs.nodeId_, nodeId); 3359 EXPECT_EQ(inspectTabs.tag_, tag); 3360 } 3361 3362 /** 3363 * @tc.name: InspectTabsTest002 3364 * @tc.desc: InspectTabs::PackAttrAndStyle 3365 * @tc.type: FUNC 3366 */ 3367 HWTEST_F(JSInspectorTest, InspectTabsTest002, TestSize.Level1) 3368 { 3369 NodeId nodeId = -1; 3370 std::string tag = "tagTest"; 3371 InspectTabs inspectTabs(nodeId, tag); 3372 auto attrsSize = inspectTabs.attrs_.size(); 3373 auto stylesSize = inspectTabs.styles_.size(); 3374 uint16_t attrsSizeInsert = 4; 3375 3376 inspectTabs.PackAttrAndStyle(); 3377 EXPECT_EQ(inspectTabs.attrs_.size(), attrsSize + attrsSizeInsert); 3378 EXPECT_EQ(inspectTabs.attrs_["index"], "0"); 3379 EXPECT_EQ(inspectTabs.attrs_["vertical"], "false"); 3380 EXPECT_EQ(inspectTabs.attrs_["disabled"], "false"); 3381 EXPECT_EQ(inspectTabs.attrs_["focusable"], "true"); 3382 EXPECT_EQ(inspectTabs.styles_.size(), stylesSize); 3383 } 3384 3385 /** 3386 * @tc.name: InspectTextTest001 3387 * @tc.desc: InspectText::InspectText 3388 * @tc.type: FUNC 3389 */ 3390 HWTEST_F(JSInspectorTest, InspectTextTest001, TestSize.Level1) 3391 { 3392 NodeId nodeId = -1; 3393 std::string tag = "tagTest"; 3394 InspectText inspectText(nodeId, tag); 3395 EXPECT_EQ(inspectText.nodeId_, nodeId); 3396 EXPECT_EQ(inspectText.tag_, tag); 3397 } 3398 3399 /** 3400 * @tc.name: InspectTextTest002 3401 * @tc.desc: InspectText::PackAttrAndStyle 3402 * @tc.type: FUNC 3403 */ 3404 HWTEST_F(JSInspectorTest, InspectTextTest002, TestSize.Level1) 3405 { 3406 NodeId nodeId = -1; 3407 std::string tag = "tagTest"; 3408 uint16_t typeNum = 6; 3409 DeviceType deviceType = SystemProperties::GetDeviceType(); 3410 for (uint16_t i = 0; i < typeNum; i++) { 3411 InspectText inspectText(nodeId, tag); 3412 auto attrsSize = inspectText.attrs_.size(); 3413 auto stylesSize = inspectText.styles_.size(); 3414 SystemProperties::SetDeviceType(static_cast<DeviceType>(i)); 3415 inspectText.PackAttrAndStyle(); 3416 CheckTextAttrAndStyle(inspectText, attrsSize, stylesSize); 3417 } 3418 SystemProperties::SetDeviceType(deviceType); 3419 } 3420 3421 /** 3422 * @tc.name: InspectTextAreaTest001 3423 * @tc.desc: InspectTextArea::InspectTextArea 3424 * @tc.type: FUNC 3425 */ 3426 HWTEST_F(JSInspectorTest, InspectTextAreaTest001, TestSize.Level1) 3427 { 3428 NodeId nodeId = -1; 3429 std::string tag = "tagTest"; 3430 InspectTextArea inspectTextArea(nodeId, tag); 3431 EXPECT_EQ(inspectTextArea.nodeId_, nodeId); 3432 EXPECT_EQ(inspectTextArea.tag_, tag); 3433 } 3434 3435 /** 3436 * @tc.name: InspectTextAreaTest002 3437 * @tc.desc: InspectTextArea::PackAttrAndStyle 3438 * @tc.type: FUNC 3439 */ 3440 HWTEST_F(JSInspectorTest, InspectTextAreaTest002, TestSize.Level1) 3441 { 3442 NodeId nodeId = -1; 3443 std::string tag = "tagTest"; 3444 uint16_t typeNum = 6; 3445 DeviceType deviceType = SystemProperties::GetDeviceType(); 3446 for (uint16_t i = 0; i < typeNum; i++) { 3447 InspectTextArea inspectTextArea(nodeId, tag); 3448 auto attrsSize = inspectTextArea.attrs_.size(); 3449 auto stylesSize = inspectTextArea.styles_.size(); 3450 SystemProperties::SetDeviceType(static_cast<DeviceType>(i)); 3451 inspectTextArea.PackAttrAndStyle(); 3452 CheckTextAreaAttrAndStyle(inspectTextArea, attrsSize, stylesSize); 3453 } 3454 SystemProperties::SetDeviceType(deviceType); 3455 } 3456 3457 /** 3458 * @tc.name: InspectToggleTest001 3459 * @tc.desc: InspectToggle::InspectToggle 3460 * @tc.type: FUNC 3461 */ 3462 HWTEST_F(JSInspectorTest, InspectToggleTest001, TestSize.Level1) 3463 { 3464 NodeId nodeId = -1; 3465 std::string tag = "tagTest"; 3466 InspectToggle inspectToggle(nodeId, tag); 3467 EXPECT_EQ(inspectToggle.nodeId_, nodeId); 3468 EXPECT_EQ(inspectToggle.tag_, tag); 3469 } 3470 3471 /** 3472 * @tc.name: InspectToggleTest002 3473 * @tc.desc: InspectToggle::PackAttrAndStyle 3474 * @tc.type: FUNC 3475 */ 3476 HWTEST_F(JSInspectorTest, InspectToggleTest002, TestSize.Level1) 3477 { 3478 NodeId nodeId = -1; 3479 std::string tag = "tagTest"; 3480 uint16_t typeNum = 6; 3481 DeviceType deviceType = SystemProperties::GetDeviceType(); 3482 for (uint16_t i = 0; i < typeNum; i++) { 3483 InspectToggle inspectToggle(nodeId, tag); 3484 auto attrsSize = inspectToggle.attrs_.size(); 3485 auto stylesSize = inspectToggle.styles_.size(); 3486 SystemProperties::SetDeviceType(static_cast<DeviceType>(i)); 3487 inspectToggle.PackAttrAndStyle(); 3488 CheckToggleAttrAndStyle(inspectToggle, attrsSize, stylesSize); 3489 } 3490 SystemProperties::SetDeviceType(deviceType); 3491 } 3492 3493 /** 3494 * @tc.name: InspectToolbarItemTest001 3495 * @tc.desc: InspectToolbarItem::InspectToolbarItem 3496 * @tc.type: FUNC 3497 */ 3498 HWTEST_F(JSInspectorTest, InspectToolbarItemTest001, TestSize.Level1) 3499 { 3500 NodeId nodeId = -1; 3501 std::string tag = "tagTest"; 3502 InspectToolbarItem inspectToolbarItem(nodeId, tag); 3503 EXPECT_EQ(inspectToolbarItem.nodeId_, nodeId); 3504 EXPECT_EQ(inspectToolbarItem.tag_, tag); 3505 } 3506 3507 /** 3508 * @tc.name: InspectToolbarItemTest002 3509 * @tc.desc: InspectToolbarItem::PackAttrAndStyle 3510 * @tc.type: FUNC 3511 */ 3512 HWTEST_F(JSInspectorTest, InspectToolbarItemTest002, TestSize.Level1) 3513 { 3514 NodeId nodeId = -1; 3515 std::string tag = "tagTest"; 3516 InspectToolbarItem inspectToolbarItem(nodeId, tag); 3517 auto attrsSize = inspectToolbarItem.attrs_.size(); 3518 auto stylesSize = inspectToolbarItem.styles_.size(); 3519 uint16_t attrsSizeInsert = 2; 3520 uint16_t stylesSizeInsert = 13; 3521 3522 inspectToolbarItem.PackAttrAndStyle(); 3523 EXPECT_EQ(inspectToolbarItem.attrs_.size(), attrsSize + attrsSizeInsert); 3524 EXPECT_EQ(inspectToolbarItem.attrs_["disabled"], "false"); 3525 EXPECT_EQ(inspectToolbarItem.attrs_["focusable"], "false"); 3526 EXPECT_EQ(inspectToolbarItem.styles_.size(), stylesSize + stylesSizeInsert); 3527 EXPECT_EQ(inspectToolbarItem.styles_["color"], "#e6000000"); 3528 EXPECT_EQ(inspectToolbarItem.styles_["font-size"], "16px"); 3529 EXPECT_EQ(inspectToolbarItem.styles_["allow-scale"], "true"); 3530 EXPECT_EQ(inspectToolbarItem.styles_["font-style"], "normal"); 3531 EXPECT_EQ(inspectToolbarItem.styles_["font-weight"], "normal"); 3532 EXPECT_EQ(inspectToolbarItem.styles_["text-decoration"], "none"); 3533 EXPECT_EQ(inspectToolbarItem.styles_["font-family"], "sans-serif"); 3534 EXPECT_EQ(inspectToolbarItem.styles_["background-size"], "auto"); 3535 EXPECT_EQ(inspectToolbarItem.styles_["background-repeat"], "repeat"); 3536 EXPECT_EQ(inspectToolbarItem.styles_["background-position"], "0px 0px"); 3537 EXPECT_EQ(inspectToolbarItem.styles_["opacity"], "1"); 3538 EXPECT_EQ(inspectToolbarItem.styles_["display"], "flex"); 3539 EXPECT_EQ(inspectToolbarItem.styles_["visibility"], "visible"); 3540 } 3541 3542 /** 3543 * @tc.name: InspectToolbarTest001 3544 * @tc.desc: InspectToolbar::InspectToolbar 3545 * @tc.type: FUNC 3546 */ 3547 HWTEST_F(JSInspectorTest, InspectToolbarTest001, TestSize.Level1) 3548 { 3549 NodeId nodeId = -1; 3550 std::string tag = "tagTest"; 3551 InspectToolbar inspectToolbar(nodeId, tag); 3552 EXPECT_EQ(inspectToolbar.nodeId_, nodeId); 3553 EXPECT_EQ(inspectToolbar.tag_, tag); 3554 } 3555 3556 /** 3557 * @tc.name: InspectVideoTest001 3558 * @tc.desc: InspectVideo::InspectVideo 3559 * @tc.type: FUNC 3560 */ 3561 HWTEST_F(JSInspectorTest, InspectVideoTest001, TestSize.Level1) 3562 { 3563 NodeId nodeId = -1; 3564 std::string tag = "tagTest"; 3565 InspectVideo inspectVideo(nodeId, tag); 3566 EXPECT_EQ(inspectVideo.nodeId_, nodeId); 3567 EXPECT_EQ(inspectVideo.tag_, tag); 3568 } 3569 3570 /** 3571 * @tc.name: InspectVideoTest002 3572 * @tc.desc: InspectVideo::PackAttrAndStyle 3573 * @tc.type: FUNC 3574 */ 3575 HWTEST_F(JSInspectorTest, InspectVideoTest002, TestSize.Level1) 3576 { 3577 NodeId nodeId = -1; 3578 std::string tag = "tagTest"; 3579 InspectVideo inspectVideo(nodeId, tag); 3580 auto attrsSize = inspectVideo.attrs_.size(); 3581 auto stylesSize = inspectVideo.styles_.size(); 3582 uint16_t attrsSizeInsert = 5; 3583 uint16_t stylesSizeInsert = 1; 3584 3585 inspectVideo.PackAttrAndStyle(); 3586 EXPECT_EQ(inspectVideo.attrs_.size(), attrsSize + attrsSizeInsert); 3587 EXPECT_EQ(inspectVideo.attrs_["muted"], "false"); 3588 EXPECT_EQ(inspectVideo.attrs_["autoplay"], "false"); 3589 EXPECT_EQ(inspectVideo.attrs_["controls"], "true"); 3590 EXPECT_EQ(inspectVideo.attrs_["disabled"], "false"); 3591 EXPECT_EQ(inspectVideo.attrs_["focusable"], "true"); 3592 EXPECT_EQ(inspectVideo.styles_.size(), stylesSize + stylesSizeInsert); 3593 EXPECT_EQ(inspectVideo.styles_["object-fit"], "contain"); 3594 } 3595 } // namespace OHOS::Ace::Framework 3596