1 /* 2 * Copyright (c) 2024 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 #include "updater_ui_env.h" 18 #include <unistd.h> 19 #include "callback_manager.h" 20 #include "common/graphic_startup.h" 21 #include "common/screen.h" 22 #include "components/root_view.h" 23 #include "graphic_engine.h" 24 #include "input_event.h" 25 #include "language/language_ui.h" 26 #include "log/log.h" 27 #include "page/page_manager.h" 28 #include "updater_ui_config.h" 29 30 using namespace testing::ext; 31 using namespace Updater; 32 33 namespace UpdaterUt { 34 class UpdaterUiEnvUnitTest : public testing::Test { 35 public: SetUpTestCase(void)36 static void SetUpTestCase(void) {} TearDownTestCase(void)37 static void TearDownTestCase(void) {} SetUp()38 void SetUp() override {} TearDown()39 void TearDown() override {} 40 }; 41 42 constexpr std::pair MY_BRIGHTNESS_FILE = 43 std::pair { "/data/updater/ui/brightness", "/data/updater/ui/max_brightness" }; 44 45 HWTEST_F(UpdaterUiEnvUnitTest, test_updater_ui_env_bright_init, TestSize.Level0) 46 { 47 EXPECT_FALSE(UpdaterUiEnv::InitBrightness("/fakebrightness", "/fakemaxbrightness")); 48 EXPECT_FALSE(UpdaterUiEnv::InitBrightness(MY_BRIGHTNESS_FILE.first, "/fakemaxbrightness")); 49 EXPECT_TRUE(UpdaterUiEnv::InitBrightness(MY_BRIGHTNESS_FILE.first, MY_BRIGHTNESS_FILE.second)); 50 } 51 }