!3722 Add UT for high contrast text.

Merge pull request !3722 from chenlushen/ls_remote
This commit is contained in:
openharmony_ci 2023-02-22 01:49:14 +00:00 committed by Gitee
commit 5244a2880f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 71 additions and 0 deletions

View File

@ -21,6 +21,7 @@ group("unittest") {
testonly = true
deps = [
":RSBaseRenderEngineUnitTest",
":RSBaseRenderUtilTest",
":RSColdStartThreadTest",
":RSComposerAdapterTest",
@ -269,6 +270,15 @@ ohos_unittest("RSUniRenderVirtualProcessorTest") {
defines += gpu_defines
}
## Build RSBaseRenderEngineUnitTest
ohos_unittest("RSBaseRenderEngineUnitTest") {
module_out_path = module_output_path
sources = [ "rs_base_render_engine_test.cpp" ]
deps = [ ":rs_test_common" ]
defines = []
defines += gpu_defines
}
## Build rs_test_common.a {{{
config("rs_test_common_public_config") {
include_dirs = [

View File

@ -0,0 +1,61 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, Hardware
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "gtest/gtest.h"
#include "pipeline/rs_base_render_engine.h"
using namespace testing;
using namespace testing::ext;
namespace OHOS::Rosen {
class RSBaseRenderEngineUnitTest : public testing::Test {
public:
static void SetUpTestCase();
static void TearDownTestCase();
void SetUp() override;
void TearDown() override;
};
void RSBaseRenderEngineUnitTest::SetUpTestCase() {}
void RSBaseRenderEngineUnitTest::TearDownTestCase() {}
void RSBaseRenderEngineUnitTest::SetUp() {}
void RSBaseRenderEngineUnitTest::TearDown() {}
/**
* @tc.name: SetHighContrast_001
* @tc.desc: Test SetHighContrast, input false, expect RSBaseRenderEngine::IsHighContrastEnabled() to be same as input
* @tc.type: FUNC
* @tc.require: issueI6GJ1Z
*/
HWTEST(RSBaseRenderEngineUnitTest, SetHighContrast_001, TestSize.Level2)
{
bool contrastEnabled = false;
RSBaseRenderEngine::SetHighContrast(contrastEnabled);
ASSERT_EQ(contrastEnabled, RSBaseRenderEngine::IsHighContrastEnabled());
}
/**
* @tc.name: SetHighContrast_002
* @tc.desc: Test SetHighContrast, input true, expect RSBaseRenderEngine::IsHighContrastEnabled() to be same as input
* @tc.type: FUNC
* @tc.require: issueI6GJ1Z
*/
HWTEST(RSBaseRenderEngineUnitTest, SetHighContrast_002, TestSize.Level2)
{
bool contrastEnabled = true;
RSBaseRenderEngine::SetHighContrast(contrastEnabled);
ASSERT_EQ(contrastEnabled, RSBaseRenderEngine::IsHighContrastEnabled());
}
}