• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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 "display.h"
18 #include "display_info.h"
19 #include "oh_display_capture.h"
20 #include "oh_display_manager.h"
21 #include "oh_display_manager_inner.h"
22 #include "pixelmap_native_impl.h"
23 
24 using namespace testing;
25 using namespace testing::ext;
26 
27 namespace OHOS {
28 namespace Rosen {
29 class OHDisplayManagerTest : public testing::Test {
30 public:
31     static void SetUpTestCase();
32     static void TearDownTestCase();
33     static void FoldDisplayModeChangeCallback(NativeDisplayManager_FoldDisplayMode displayMode);
34     static void DisplayChangeCallback(uint64_t displayId);
35     void SetUp() override;
36     void TearDown() override;
37 };
38 
39 
SetUpTestCase()40 void OHDisplayManagerTest::SetUpTestCase()
41 {
42 }
43 
TearDownTestCase()44 void OHDisplayManagerTest::TearDownTestCase()
45 {
46 }
47 
SetUp()48 void OHDisplayManagerTest::SetUp()
49 {
50 }
51 
TearDown()52 void OHDisplayManagerTest::TearDown()
53 {
54 }
55 
FoldDisplayModeChangeCallback(NativeDisplayManager_FoldDisplayMode displayMode)56 void OHDisplayManagerTest::FoldDisplayModeChangeCallback(NativeDisplayManager_FoldDisplayMode displayMode)
57 {
58 }
59 
DisplayChangeCallback(uint64_t displayId)60 void OHDisplayManagerTest::DisplayChangeCallback(uint64_t displayId)
61 {
62 }
63 namespace {
64 
65 /**
66  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayId
67  * @tc.desc: displayId == nullptr
68  * @tc.type: FUNC
69  */
70 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayId01, Function | SmallTest | Level2)
71 {
72     uint64_t *displayId = nullptr;
73     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayId(displayId);
74     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_INVALID_PARAM);
75 }
76 
77 /**
78  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayId
79  * @tc.desc: displayId != nullptr
80  * @tc.type: FUNC
81  */
82 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayId02, Function | SmallTest | Level2)
83 {
84     uint64_t testParm = 4000;
85     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayId(&testParm);
86     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
87 }
88 
89 /**
90  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayWidth
91  * @tc.desc: displayWidth == nullptr
92  * @tc.type: FUNC
93  */
94 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayWidth01, Function | SmallTest | Level2)
95 {
96     int32_t *displayWidth = nullptr;
97     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayWidth(displayWidth);
98     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_INVALID_PARAM);
99 }
100 
101 /**
102  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayWidth
103  * @tc.desc: displayWidth != nullptr
104  * @tc.type: FUNC
105  */
106 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayWidth02, Function | SmallTest | Level2)
107 {
108     int32_t testWidth = 200;
109     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayWidth(&testWidth);
110     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
111 }
112 
113 /**
114  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayHeight
115  * @tc.desc: displayHeight == nullptr
116  * @tc.type: FUNC
117  */
118 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayHeight01, Function | SmallTest | Level2)
119 {
120     int32_t *displayHeight = nullptr;
121     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayHeight(displayHeight);
122     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_INVALID_PARAM);
123 }
124 
125 /**
126  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayHeight
127  * @tc.desc: displayHeight != nullptr
128  * @tc.type: FUNC
129  */
130 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayHeight02, Function | SmallTest | Level2)
131 {
132     int32_t testHeight = 200;
133     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayHeight(&testHeight);
134     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
135 }
136 
137 /**
138  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayRotation
139  * @tc.desc: displayRotation == nullptr
140  * @tc.type: FUNC
141  */
142 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayRotation01, Function | SmallTest | Level2)
143 {
144     NativeDisplayManager_Rotation *displayRotation = nullptr;
145     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayRotation(displayRotation);
146     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_INVALID_PARAM);
147 }
148 
149 /**
150  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayRotation
151  * @tc.desc: displayRotation != nullptr
152  * @tc.type: FUNC
153  */
154 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayRotation02, Function | SmallTest | Level2)
155 {
156     NativeDisplayManager_Rotation testRotation = NativeDisplayManager_Rotation::DISPLAY_MANAGER_ROTATION_180;
157     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayRotation(&testRotation);
158     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
159 }
160 
161 /**
162  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayOrientation
163  * @tc.desc: displayOrientation == nullptr
164  * @tc.type: FUNC
165  */
166 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayOrientation01, Function | SmallTest | Level2)
167 {
168     NativeDisplayManager_Orientation *displayOrientation = nullptr;
169     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayOrientation(displayOrientation);
170     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_INVALID_PARAM);
171 }
172 
173 /**
174  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayOrientation
175  * @tc.desc: displayOrientation != nullptr
176  * @tc.type: FUNC
177  */
178 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayOrientation02, Function | SmallTest | Level2)
179 {
180     NativeDisplayManager_Orientation testOrientation = NativeDisplayManager_Orientation::DISPLAY_MANAGER_LANDSCAPE;
181     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayOrientation(&testOrientation);
182     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
183 }
184 
185 /**
186  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayVirtualPixelRatio
187  * @tc.desc: virtualPixel == nullptr
188  * @tc.type: FUNC
189  */
190 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayVirtualPixelRatio01,
191     Function | SmallTest | Level2)
192 {
193     float *virtualPixel = nullptr;
194     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayVirtualPixelRatio(virtualPixel);
195     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_INVALID_PARAM);
196 }
197 
198 /**
199  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayVirtualPixelRatio
200  * @tc.desc: virtualPixel != nullptr
201  * @tc.type: FUNC
202  */
203 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayVirtualPixelRatio02,
204     Function | SmallTest | Level2)
205 {
206     float testPixel = 3.14;
207     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayVirtualPixelRatio(&testPixel);
208     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
209 }
210 
211 /**
212  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayRefreshRate
213  * @tc.desc: refreshRate == nullptr
214  * @tc.type: FUNC
215  */
216 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayRefreshRate01, Function | SmallTest | Level2)
217 {
218     uint32_t *refreshRate = nullptr;
219     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayRefreshRate(refreshRate);
220     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_INVALID_PARAM);
221 }
222 
223 /**
224  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayRefreshRate
225  * @tc.desc: refreshRate != nullptr
226  * @tc.type: FUNC
227  */
228 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayRefreshRate02, Function | SmallTest | Level2)
229 {
230     uint32_t testRate = 60;
231     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayRefreshRate(&testRate);
232     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
233 }
234 
235 /**
236  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayDensityDpi
237  * @tc.desc: densityDpi == nullptr
238  * @tc.type: FUNC
239  */
240 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayDensityDpi01, Function | SmallTest | Level2)
241 {
242     int32_t *densityDpi = nullptr;
243     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayDensityDpi(densityDpi);
244     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_INVALID_PARAM);
245 }
246 
247 /**
248  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayDensityDpi
249  * @tc.desc: densityDpi != nullptr
250  * @tc.type: FUNC
251  */
252 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayDensityDpi02, Function | SmallTest | Level2)
253 {
254     int32_t testDpi = 160;
255     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayDensityDpi(&testDpi);
256     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
257 }
258 
259 /**
260  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayDensityPixels
261  * @tc.desc: densityPixels == nullptr
262  * @tc.type: FUNC
263  */
264 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayDensityPixels01, Function | SmallTest | Level2)
265 {
266     float *densityPixels = nullptr;
267     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayDensityPixels(densityPixels);
268     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_INVALID_PARAM);
269 }
270 
271 /**
272  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayDensityPixels
273  * @tc.desc: densityPixels != nullptr
274  * @tc.type: FUNC
275  */
276 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayDensityPixels02, Function | SmallTest | Level2)
277 {
278     float testPixels = 1.0;
279     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayDensityPixels(&testPixels);
280     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
281 }
282 
283 /**
284  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayScaledDensity
285  * @tc.desc: scaledDensity == nullptr
286  * @tc.type: FUNC
287  */
288 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayScaledDensity01, Function | SmallTest | Level2)
289 {
290     float *scaledDensity = nullptr;
291     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayScaledDensity(scaledDensity);
292     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_INVALID_PARAM);
293 }
294 
295 /**
296  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayScaledDensity
297  * @tc.desc: scaledDensity != nullptr
298  * @tc.type: FUNC
299  */
300 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayScaledDensity02, Function | SmallTest | Level2)
301 {
302     float testDensity = 1.0;
303     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayScaledDensity(&testDensity);
304     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
305 }
306 
307 /**
308  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayDensityXdpi
309  * @tc.desc: xDpi == nullptr
310  * @tc.type: FUNC
311  */
312 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayDensityXdpi01, Function | SmallTest | Level2)
313 {
314     float *xDpi = nullptr;
315     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayDensityXdpi(xDpi);
316     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_INVALID_PARAM);
317 }
318 
319 /**
320  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayDensityXdpi
321  * @tc.desc: xDpi != nullptr
322  * @tc.type: FUNC
323  */
324 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayDensityXdpi02, Function | SmallTest | Level2)
325 {
326     float testXDpi = 2.0;
327     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayDensityXdpi(&testXDpi);
328     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
329 }
330 
331 /**
332  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayDensityYdpi
333  * @tc.desc: yDpi == nullptr
334  * @tc.type: FUNC
335  */
336 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayDensityYdpi01, Function | SmallTest | Level2)
337 {
338     float *yDpi = nullptr;
339     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayDensityYdpi(yDpi);
340     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_INVALID_PARAM);
341 }
342 
343 /**
344  * @tc.name: OH_NativeDisplayManager_GetDefaultDisplayDensityYdpi
345  * @tc.desc: yDpi != nullptr
346  * @tc.type: FUNC
347  */
348 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetDefaultDisplayDensityYdpi02, Function | SmallTest | Level2)
349 {
350     float testYDpi = 2.0;
351     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetDefaultDisplayDensityYdpi(&testYDpi);
352     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
353 }
354 
355 /**
356  * @tc.name: OH_NativeDisplayManager_GetFoldDisplayMode
357  * @tc.desc: foldDisplayMode == nullptr
358  * @tc.type: FUNC
359  */
360 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetFoldDisplayMode01, Function | SmallTest | Level2)
361 {
362     NativeDisplayManager_FoldDisplayMode *foldDisplayMode = nullptr;
363     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetFoldDisplayMode(foldDisplayMode);
364     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_INVALID_PARAM);
365 }
366 
367 /**
368  * @tc.name: OH_NativeDisplayManager_GetFoldDisplayMode
369  * @tc.desc: foldDisplayMode != nullptr
370  * @tc.type: FUNC
371  */
372 HWTEST_F(OHDisplayManagerTest, OH_NativeDisplayManager_GetFoldDisplayMode02, Function | SmallTest | Level2)
373 {
374     NativeDisplayManager_FoldDisplayMode testDisplayMode =
375         NativeDisplayManager_FoldDisplayMode::DISPLAY_MANAGER_FOLD_DISPLAY_MODE_MAIN;
376     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_GetFoldDisplayMode(&testDisplayMode);
377     if (OH_NativeDisplayManager_IsFoldable()) {
378         EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
379     } else {
380         EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_DEVICE_NOT_SUPPORTED);
381     }
382 }
383 
384 /**
385  * @tc.name: FoldDisplayModeChangeListener
386  * @tc.desc: register and unregister
387  * @tc.type: FUNC
388  */
389 HWTEST_F(OHDisplayManagerTest, FoldDisplayModeChangeListener, Function | SmallTest | Level2)
390 {
391     uint32_t testIndex;
392     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_RegisterFoldDisplayModeChangeListener(
393         FoldDisplayModeChangeCallback, &testIndex);
394     if (OH_NativeDisplayManager_IsFoldable()) {
395         EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
396         NativeDisplayManager_ErrorCode ret1 = OH_NativeDisplayManager_UnregisterFoldDisplayModeChangeListener(
397             testIndex);
398         EXPECT_EQ(ret1, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
399     } else {
400         EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_DEVICE_NOT_SUPPORTED);
401     }
402 }
403 
404 /**
405  * @tc.name: DisplayChangeListener
406  * @tc.desc: register and unregister
407  * @tc.type: FUNC
408  */
409 HWTEST_F(OHDisplayManagerTest, DisplayChangeListener, Function | SmallTest | Level2)
410 {
411     uint32_t testIndex;
412     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_RegisterDisplayChangeListener(
413         DisplayChangeCallback, &testIndex);
414     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
415     ret = OH_NativeDisplayManager_UnregisterDisplayChangeListener(testIndex);
416     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
417 }
418 
419 /**
420  * @tc.name: AllDisplays
421  * @tc.desc: create and destroy
422  * @tc.type: FUNC
423  */
424 HWTEST_F(OHDisplayManagerTest, CreateAndDestroyAllDisplays, Function | SmallTest | Level2)
425 {
426     NativeDisplayManager_DisplaysInfo *displayInfo = nullptr;
427     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_CreateAllDisplays(&displayInfo);
428     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
429     ASSERT_NE(displayInfo, nullptr);
430 
431     OH_NativeDisplayManager_DestroyAllDisplays(displayInfo);
432 }
433 
434 /**
435  * @tc.name: CreateAndDestroyDisplayById
436  * @tc.desc: CreateAndDestroyDisplayById
437  * @tc.type: FUNC
438  */
439 HWTEST_F(OHDisplayManagerTest, CreateAndDestroyDisplayById, Function | SmallTest | Level2)
440 {
441     uint32_t testDisplayId = 0;
442     NativeDisplayManager_DisplayInfo *testPtr = nullptr;
443     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_CreateDisplayById(testDisplayId, &testPtr);
444     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
445 
446     OH_NativeDisplayManager_DestroyDisplay(testPtr);
447 }
448 
449 /**
450  * @tc.name: CreatePrimaryDisplay
451  * @tc.desc: CreatePrimaryDisplay
452  * @tc.type: FUNC
453  */
454 HWTEST_F(OHDisplayManagerTest, CreatePrimaryDisplay, Function | SmallTest | Level2)
455 {
456     NativeDisplayManager_DisplayInfo *testPtr = nullptr;
457     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_CreatePrimaryDisplay(&testPtr);
458     EXPECT_EQ(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_OK);
459 }
460 
461 /**
462  * @tc.name: CaptureScreenPixelmap
463  * @tc.desc: CaptureScreenPixelmap
464  * @tc.type: FUNC
465  */
466 HWTEST_F(OHDisplayManagerTest, CaptureScreenPixelmap, Function | SmallTest | Level2)
467 {
468     uint32_t testDisplayId = 1001;
469     OH_PixelmapNative *pixelMap = nullptr;
470     NativeDisplayManager_ErrorCode ret = OH_NativeDisplayManager_CaptureScreenPixelmap(testDisplayId, &pixelMap);
471     EXPECT_NE(ret, NativeDisplayManager_ErrorCode::DISPLAY_MANAGER_ERROR_NO_PERMISSION);
472 }
473 }
474 } // namespace Rosen
475 } // namespace OHOS