1 /* 2 * Copyright (c) 2020-2021 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 #ifndef UI_TEST_IMAGE_H 17 #define UI_TEST_IMAGE_H 18 19 #include "components/ui_scroll_view.h" 20 #include "imgdecode/cache_manager.h" 21 #include "ui_test.h" 22 #include "components/ui_image_view.h" 23 24 #ifndef VERSION_LITE 25 #include "components/ui_label_button.h" 26 #include "test_resource_config.h" 27 #endif 28 29 namespace OHOS { 30 #if (ENABLE_GIF == 1) 31 class UITestImage : public UITest, public OHOS::UIView::OnClickListener { 32 #else 33 class UITestImage : public UITest { 34 #endif 35 public: UITestImage()36 UITestImage() {} ~UITestImage()37 ~UITestImage() {} 38 void SetUp() override; 39 void TearDown() override; 40 const UIView* GetTestView() override; 41 void UIKit_UIImage_Test_SetImage_001(); 42 void UIKit_UIImage_Test_SetImage_002(); 43 void UIKit_UIImage_Test_SetImage_004(); 44 void UIKit_UIImage_Test_SetImage_005(); 45 void UIKit_UIImage_Test_SetImage_006(); 46 void UIKit_UIImage_Test_SetImage_007(); 47 void UIKit_UIImage_Test_SetImage_008(); 48 void UIKit_UIImage_Test_SetImage_009(); 49 void UIKit_UIImage_Test_SetImage_010(); 50 void UIKit_UIImage_Test_SetImage_011(); 51 void UIKit_UIImage_Test_SetImage_012(); 52 void UIKit_UIImage_Test_SetImage_013(); 53 void UIKit_UIImage_Test_SetImage_014(); 54 #if (ENABLE_GIF == 1) 55 void UIKit_UIImage_Test_SetImage_015(); 56 void UIKit_UIImage_Test_SetImage_016(); 57 #endif 58 void UIKit_UIImage_Test_Uncompress_001(); 59 void UIKit_UIImage_Test_Resize_001(); 60 private: 61 const char* GetCharByImageSrcType(ImageSrcType srcType) const; 62 #if (ENABLE_GIF == 1) 63 bool OnClick(UIView &view, const ClickEvent& event) override; 64 void SetUpButton(UILabelButton* btn, const char* title); 65 #endif 66 UIScrollView* container_ = nullptr; 67 #if (ENABLE_GIF == 1) 68 UIImageView* gifImageView_ = nullptr; 69 UILabelButton* gifToGif_ = nullptr; 70 UILabelButton* gifToJpeg_ = nullptr; 71 UILabelButton* gifToPng_ = nullptr; 72 UILabelButton* gifToBin01_ = nullptr; 73 UILabelButton* gifToBin02_ = nullptr; 74 UILabelButton* gifToBin03_ = nullptr; 75 UILabelButton* gifToBin04_ = nullptr; 76 #endif 77 private: 78 UILabel* AddLable(int16_t x, int16_t y, const char* data); 79 UIImageView* AddImageView(const Rect rect, const char* src, bool autoEnable, UIImageView::ImageResizeMode mode); GetRect(int16_t x,int16_t y,int16_t w,int16_t h)80 Rect GetRect(int16_t x, int16_t y, int16_t w, int16_t h) const 81 { 82 return Rect(x, y, x + w, y + h); 83 } 84 }; 85 } // namespace OHOS 86 #endif // UI_TEST_IMAGE_H 87