1e0dac50fSopenharmony_ci/* 2e0dac50fSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 3e0dac50fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4e0dac50fSopenharmony_ci * you may not use this file except in compliance with the License. 5e0dac50fSopenharmony_ci * You may obtain a copy of the License at 6e0dac50fSopenharmony_ci * 7e0dac50fSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8e0dac50fSopenharmony_ci * 9e0dac50fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10e0dac50fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11e0dac50fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12e0dac50fSopenharmony_ci * See the License for the specific language governing permissions and 13e0dac50fSopenharmony_ci * limitations under the License. 14e0dac50fSopenharmony_ci */ 15e0dac50fSopenharmony_ci 16e0dac50fSopenharmony_ci#include "surface_reader.h" 17e0dac50fSopenharmony_ci#include <gtest/gtest.h> 18e0dac50fSopenharmony_ci#include <unistd.h> 19e0dac50fSopenharmony_ci 20e0dac50fSopenharmony_ciusing namespace testing; 21e0dac50fSopenharmony_ciusing namespace testing::ext; 22e0dac50fSopenharmony_cinamespace OHOS { 23e0dac50fSopenharmony_cinamespace Rosen { 24e0dac50fSopenharmony_ciclass SurfaceReaderTest : public testing::Test { 25e0dac50fSopenharmony_ci public: 26e0dac50fSopenharmony_ci SurfaceReaderTest() {} 27e0dac50fSopenharmony_ci ~SurfaceReaderTest() {} 28e0dac50fSopenharmony_ci}; 29e0dac50fSopenharmony_ci 30e0dac50fSopenharmony_cinamespace { 31e0dac50fSopenharmony_ci/** 32e0dac50fSopenharmony_ci * @tc.name: Init 33e0dac50fSopenharmony_ci * @tc.desc: normal function 34e0dac50fSopenharmony_ci * @tc.type: FUNC 35e0dac50fSopenharmony_ci */ 36e0dac50fSopenharmony_ciHWTEST_F(SurfaceReaderTest, Init, Function | SmallTest | Level2) 37e0dac50fSopenharmony_ci{ 38e0dac50fSopenharmony_ci GTEST_LOG_(INFO) << "SurfaceReaderTest: Init start"; 39e0dac50fSopenharmony_ci SurfaceReader* reader = new(std::nothrow) SurfaceReader(); 40e0dac50fSopenharmony_ci bool res = reader->Init(); 41e0dac50fSopenharmony_ci ASSERT_EQ(res, true); 42e0dac50fSopenharmony_ci delete reader; 43e0dac50fSopenharmony_ci GTEST_LOG_(INFO) << "SurfaceReaderTest: Init end"; 44e0dac50fSopenharmony_ci} 45e0dac50fSopenharmony_ci/** 46e0dac50fSopenharmony_ci * @tc.name: OnVsync 47e0dac50fSopenharmony_ci * @tc.desc: normal function 48e0dac50fSopenharmony_ci * @tc.type: FUNC 49e0dac50fSopenharmony_ci */ 50e0dac50fSopenharmony_ciHWTEST_F(SurfaceReaderTest, OnVsync, Function | SmallTest | Level2) 51e0dac50fSopenharmony_ci{ 52e0dac50fSopenharmony_ci SurfaceReader* reader = new(std::nothrow) SurfaceReader(); 53e0dac50fSopenharmony_ci bool res = reader->Init(); 54e0dac50fSopenharmony_ci reader->OnVsync(); 55e0dac50fSopenharmony_ci delete reader; 56e0dac50fSopenharmony_ci ASSERT_EQ(res, true); 57e0dac50fSopenharmony_ci} 58e0dac50fSopenharmony_ci/** 59e0dac50fSopenharmony_ci * @tc.name: GetSurface 60e0dac50fSopenharmony_ci * @tc.desc: normal function 61e0dac50fSopenharmony_ci * @tc.type: FUNC 62e0dac50fSopenharmony_ci */ 63e0dac50fSopenharmony_ciHWTEST_F(SurfaceReaderTest, GetSurface, Function | SmallTest | Level2) 64e0dac50fSopenharmony_ci{ 65e0dac50fSopenharmony_ci SurfaceReader* reader = new(std::nothrow) SurfaceReader(); 66e0dac50fSopenharmony_ci reader->Init(); 67e0dac50fSopenharmony_ci sptr<Surface> surface = reader->GetSurface(); 68e0dac50fSopenharmony_ci ASSERT_NE(surface, nullptr); 69e0dac50fSopenharmony_ci delete reader; 70e0dac50fSopenharmony_ci} 71e0dac50fSopenharmony_ci/** 72e0dac50fSopenharmony_ci * @tc.name: SetHandler 73e0dac50fSopenharmony_ci * @tc.desc: normal function 74e0dac50fSopenharmony_ci * @tc.type: FUNC 75e0dac50fSopenharmony_ci */ 76e0dac50fSopenharmony_ciHWTEST_F(SurfaceReaderTest, SetHandler, Function | SmallTest | Level2) 77e0dac50fSopenharmony_ci{ 78e0dac50fSopenharmony_ci SurfaceReader* reader = new(std::nothrow) SurfaceReader(); 79e0dac50fSopenharmony_ci reader->SetHandler(nullptr); 80e0dac50fSopenharmony_ci ASSERT_TRUE(true); 81e0dac50fSopenharmony_ci delete reader; 82e0dac50fSopenharmony_ci} 83e0dac50fSopenharmony_ci} // namespace 84e0dac50fSopenharmony_ci} 85e0dac50fSopenharmony_ci} 86