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, Hardware
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 "drawing_error_code.h"
17 #include "drawing_sampling_options.h"
18 #include "drawing_shader_effect.h"
19 #include "gtest/gtest.h"
20
21 using namespace testing;
22 using namespace testing::ext;
23
24 namespace OHOS {
25 namespace Rosen {
26 namespace Drawing {
27 class NativeDrawingSamplingOptionsTest : public testing::Test {
28 public:
29 static void SetUpTestCase();
30 static void TearDownTestCase();
31 void SetUp() override;
32 void TearDown() override;
33 };
34
35
SetUpTestCase()36 void NativeDrawingSamplingOptionsTest::SetUpTestCase() {}
TearDownTestCase()37 void NativeDrawingSamplingOptionsTest::TearDownTestCase() {}
SetUp()38 void NativeDrawingSamplingOptionsTest::SetUp() {}
TearDown()39 void NativeDrawingSamplingOptionsTest::TearDown() {}
40
41
42 /*
43 * @tc.name: OH_Drawing_SamplingOptionsCreate
44 * @tc.desc: Test OH_Drawing_SamplingOptionsCreate
45 * @tc.type: FUNC
46 */
47 HWTEST_F(NativeDrawingSamplingOptionsTest, OH_Drawing_SamplingOptionsCreate, TestSize.Level1)
48 {
49 OH_Drawing_SamplingOptions* option1 = OH_Drawing_SamplingOptionsCreate(OH_Drawing_FilterMode::FILTER_MODE_LINEAR,
50 OH_Drawing_MipmapMode::MIPMAP_MODE_NEAREST);
51 OH_Drawing_SamplingOptions* option2 = OH_Drawing_SamplingOptionsCreate(OH_Drawing_FilterMode::FILTER_MODE_LINEAR,
52 static_cast<OH_Drawing_MipmapMode>(-1));
53 OH_Drawing_SamplingOptions* option3 = OH_Drawing_SamplingOptionsCreate(OH_Drawing_FilterMode::FILTER_MODE_LINEAR,
54 static_cast<OH_Drawing_MipmapMode>(99));
55 EXPECT_NE(option1, nullptr);
56 EXPECT_EQ(option2, nullptr);
57 EXPECT_EQ(option3, nullptr);
58
59 OH_Drawing_SamplingOptionsDestroy(option1);
60 OH_Drawing_SamplingOptionsDestroy(option2);
61 OH_Drawing_SamplingOptionsDestroy(option3);
62 }
63 } // namespace Drawing
64 } // namespace Rosen
65 } // namespace OHOS