• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /***************************************************************************
2  *
3  * Copyright 2010-2014 BMW Car IT GmbH
4  * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
5  * Copyright (C) 2016 Advanced Driver Information Technology Joint Venture GmbH
6  *
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *        http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  ****************************************************************************/
21 
22 #include <gtest/gtest.h>
23 #include <stdio.h>
24 
25 #include <unistd.h>
26 #include <sys/types.h>
27 
28 #include "TestBase.h"
29 
30 extern "C" {
31     #include "ilm_control.h"
32 }
33 
34 class IlmCommandTest : public TestBase, public ::testing::Test {
35 public:
SetUp()36     void SetUp()
37     {
38         ASSERT_EQ(ILM_SUCCESS, ilm_initWithNativedisplay((t_ilm_nativedisplay)wlDisplay));
39 
40         iviSurfaces.reserve(10);
41         struct iviSurface surf;
42         for (int i = 0; i < (int)iviSurfaces.capacity(); ++i)
43         {
44             surf.surface = ivi_application_surface_create(iviApp, i+500, wlSurfaces[i]);
45             surf.surface_id = i+500;
46             iviSurfaces.push_back(surf);
47         }
48 
49         wl_display_flush(wlDisplay);
50     }
51 
TearDown()52     void TearDown()
53     {
54         //print_lmc_get_scene();
55         t_ilm_layer* layers = NULL;
56         t_ilm_int numLayer=0;
57         EXPECT_EQ(ILM_SUCCESS, ilm_getLayerIDs(&numLayer, &layers));
58         for (t_ilm_int i=0; i<numLayer; i++)
59         {
60             EXPECT_EQ(ILM_SUCCESS, ilm_layerRemove(layers[i]));
61         };
62         free(layers);
63 
64         for (std::vector<iviSurface>::reverse_iterator it = iviSurfaces.rbegin();
65              it != iviSurfaces.rend();
66              ++it)
67         {
68             ivi_surface_destroy((*it).surface);
69         }
70         iviSurfaces.clear();
71 
72         EXPECT_EQ(ILM_SUCCESS, ilm_commitChanges());
73         EXPECT_EQ(ILM_SUCCESS, ilm_destroy());
74     }
75 };
76 
TEST_F(IlmCommandTest,SetGetSurfaceOpacity)77 TEST_F(IlmCommandTest, SetGetSurfaceOpacity) {
78     uint surface1 = iviSurfaces[0].surface_id;
79     uint surface2 = iviSurfaces[1].surface_id;
80     t_ilm_float opacity;
81 
82     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetOpacity(surface1, 0.88));
83     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
84     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceGetOpacity(surface1, &opacity));
85     EXPECT_NEAR(0.88, opacity, 0.01);
86 
87     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetOpacity(surface2, 0.001));
88     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
89     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceGetOpacity(surface2, &opacity));
90     EXPECT_NEAR(0.001, opacity, 0.01);
91 }
92 
TEST_F(IlmCommandTest,SetGetSurfaceOpacity_InvalidInput)93 TEST_F(IlmCommandTest, SetGetSurfaceOpacity_InvalidInput) {
94     t_ilm_uint surface = 0xdeadbeef;
95     t_ilm_float opacity;
96 
97     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetOpacity(surface, 0.88));
98     ASSERT_EQ(ILM_ERROR_RESOURCE_NOT_FOUND, ilm_getError());
99     ASSERT_NE(ILM_SUCCESS, ilm_surfaceGetOpacity(surface, &opacity));
100 }
101 
TEST_F(IlmCommandTest,SetGetLayerOpacity)102 TEST_F(IlmCommandTest, SetGetLayerOpacity) {
103     uint layer1 = 36;
104     uint layer2 = 44;
105     t_ilm_float opacity;
106 
107     ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(&layer1, 800, 480));
108     ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(&layer2, 800, 480));
109 
110     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetOpacity(layer1, 0.88));
111     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
112     ASSERT_EQ(ILM_SUCCESS, ilm_layerGetOpacity(layer1, &opacity));
113     EXPECT_NEAR(0.88, opacity, 0.01);
114 
115     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetOpacity(layer2, 0.001));
116     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
117     ASSERT_EQ(ILM_SUCCESS, ilm_layerGetOpacity(layer2, &opacity));
118     EXPECT_NEAR(0.001, opacity, 0.01);
119 }
120 
TEST_F(IlmCommandTest,SetGetLayerOpacity_InvalidInput)121 TEST_F(IlmCommandTest, SetGetLayerOpacity_InvalidInput) {
122     t_ilm_layer layer = 0xdeadbeef;
123     t_ilm_float opacity;
124 
125     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetOpacity(layer, 0.88));
126     ASSERT_EQ(ILM_ERROR_RESOURCE_NOT_FOUND, ilm_getError());
127     ASSERT_NE(ILM_SUCCESS, ilm_layerGetOpacity(layer, &opacity));
128 }
129 
TEST_F(IlmCommandTest,SetGetSurfaceVisibility)130 TEST_F(IlmCommandTest, SetGetSurfaceVisibility) {
131     uint surface = iviSurfaces[0].surface_id;
132     t_ilm_bool visibility;
133 
134     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetVisibility(surface, ILM_TRUE));
135     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
136     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceGetVisibility(surface, &visibility));
137     ASSERT_EQ(ILM_TRUE, visibility);
138 
139     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetVisibility(surface, ILM_FALSE));
140     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
141     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceGetVisibility(surface, &visibility));
142     ASSERT_EQ(ILM_FALSE, visibility);
143 
144     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetVisibility(surface, ILM_TRUE));
145     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
146     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceGetVisibility(surface, &visibility));
147     ASSERT_EQ(ILM_TRUE, visibility);
148 }
149 
TEST_F(IlmCommandTest,SetGetSurfaceVisibility_InvalidInput)150 TEST_F(IlmCommandTest, SetGetSurfaceVisibility_InvalidInput) {
151     uint surface = 0xdeadbeef;
152     t_ilm_bool visibility;
153 
154     ASSERT_NE(ILM_SUCCESS, ilm_surfaceGetVisibility(surface, &visibility));
155     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetVisibility(surface, ILM_TRUE));
156     ASSERT_EQ(ILM_ERROR_RESOURCE_NOT_FOUND, ilm_getError());
157     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetVisibility(surface, ILM_FALSE));
158     ASSERT_EQ(ILM_ERROR_RESOURCE_NOT_FOUND, ilm_getError());
159 }
160 
TEST_F(IlmCommandTest,SetGetLayerVisibility)161 TEST_F(IlmCommandTest, SetGetLayerVisibility) {
162     uint layer = 36;
163     t_ilm_bool visibility;
164 
165     ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(&layer, 800, 480));
166 
167     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetVisibility(layer, ILM_TRUE));
168     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
169     ASSERT_EQ(ILM_SUCCESS, ilm_layerGetVisibility(layer, &visibility));
170     ASSERT_EQ(ILM_TRUE, visibility);
171 
172     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetVisibility(layer, ILM_FALSE));
173     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
174     ASSERT_EQ(ILM_SUCCESS, ilm_layerGetVisibility(layer, &visibility));
175     ASSERT_EQ(ILM_FALSE, visibility);
176 
177     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetVisibility(layer, ILM_TRUE));
178     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
179     ASSERT_EQ(ILM_SUCCESS, ilm_layerGetVisibility(layer, &visibility));
180     ASSERT_EQ(ILM_TRUE, visibility);
181 }
182 
TEST_F(IlmCommandTest,SetGetLayerVisibility_InvalidInput)183 TEST_F(IlmCommandTest, SetGetLayerVisibility_InvalidInput) {
184     uint layer = 0xdeadbeef;
185     t_ilm_bool visibility;
186 
187     ASSERT_NE(ILM_SUCCESS, ilm_layerGetVisibility(layer, &visibility));
188     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetVisibility(layer, ILM_TRUE));
189     ASSERT_EQ(ILM_ERROR_RESOURCE_NOT_FOUND, ilm_getError());
190     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetVisibility(layer, ILM_FALSE));
191     ASSERT_EQ(ILM_ERROR_RESOURCE_NOT_FOUND, ilm_getError());
192 }
193 
TEST_F(IlmCommandTest,SetSurfaceSourceRectangle)194 TEST_F(IlmCommandTest, SetSurfaceSourceRectangle) {
195     t_ilm_uint surface = iviSurfaces[0].surface_id;
196 
197     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetSourceRectangle(surface, 89, 6538, 638, 4));
198     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
199 
200     ilmSurfaceProperties surfaceProperties;
201     ASSERT_EQ(ILM_SUCCESS, ilm_getPropertiesOfSurface(surface, &surfaceProperties));
202     ASSERT_EQ(89u, surfaceProperties.sourceX);
203     ASSERT_EQ(6538u, surfaceProperties.sourceY);
204     ASSERT_EQ(638u, surfaceProperties.sourceWidth);
205     ASSERT_EQ(4u, surfaceProperties.sourceHeight);
206 }
207 
TEST_F(IlmCommandTest,SetSurfaceSourceRectangle_InvalidInput)208 TEST_F(IlmCommandTest, SetSurfaceSourceRectangle_InvalidInput) {
209     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetSourceRectangle(0xdeadbeef, 89, 6538, 638, 4));
210     ASSERT_EQ(ILM_ERROR_RESOURCE_NOT_FOUND, ilm_getError());
211 }
212 
TEST_F(IlmCommandTest,ilm_getScreenIDs)213 TEST_F(IlmCommandTest, ilm_getScreenIDs) {
214     t_ilm_uint numberOfScreens;
215     t_ilm_uint* screenIDs;
216     ASSERT_EQ(ILM_SUCCESS, ilm_getScreenIDs(&numberOfScreens, &screenIDs));
217     EXPECT_GT(numberOfScreens, 0u);
218     free(screenIDs);
219 }
220 
TEST_F(IlmCommandTest,ilm_getScreenResolution_SingleScreen)221 TEST_F(IlmCommandTest, ilm_getScreenResolution_SingleScreen) {
222     t_ilm_uint numberOfScreens;
223     t_ilm_uint* screenIDs;
224     ASSERT_EQ(ILM_SUCCESS, ilm_getScreenIDs(&numberOfScreens, &screenIDs));
225     EXPECT_TRUE(numberOfScreens>0);
226 
227     if (numberOfScreens > 0)
228     {
229         uint firstScreen = screenIDs[0];
230         t_ilm_uint width = 0, height = 0;
231         EXPECT_EQ(ILM_SUCCESS, ilm_getScreenResolution(firstScreen, &width, &height));
232         EXPECT_GT(width, 0u);
233         EXPECT_GT(height, 0u);
234     }
235 
236     free(screenIDs);
237 }
238 
TEST_F(IlmCommandTest,ilm_getScreenResolution_MultiScreen)239 TEST_F(IlmCommandTest, ilm_getScreenResolution_MultiScreen) {
240     t_ilm_uint numberOfScreens;
241     t_ilm_uint* screenIDs;
242     ASSERT_EQ(ILM_SUCCESS, ilm_getScreenIDs(&numberOfScreens, &screenIDs));
243     EXPECT_TRUE(numberOfScreens>0);
244 
245     for (uint screenIndex = 0; screenIndex < numberOfScreens; ++screenIndex)
246     {
247         uint screen = screenIDs[screenIndex];
248         t_ilm_uint width = 0, height = 0;
249         EXPECT_EQ(ILM_SUCCESS, ilm_getScreenResolution(screen, &width, &height));
250         EXPECT_GT(width, 0u);
251         EXPECT_GT(height, 0u);
252     }
253 
254     free(screenIDs);
255 }
256 
TEST_F(IlmCommandTest,ilm_getLayerIDs)257 TEST_F(IlmCommandTest, ilm_getLayerIDs) {
258     uint layer1 = 3246;
259     uint layer2 = 46586;
260 
261     ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(&layer1, 800, 480));
262     ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(&layer2, 800, 480));
263     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
264 
265     t_ilm_int length;
266     t_ilm_uint* IDs;
267     ASSERT_EQ(ILM_SUCCESS, ilm_getLayerIDs(&length, &IDs));
268 
269     EXPECT_EQ(layer1, IDs[0]);
270     EXPECT_EQ(layer2, IDs[1]);
271     free(IDs);
272 }
273 
TEST_F(IlmCommandTest,ilm_getLayerIDsOfScreen)274 TEST_F(IlmCommandTest, ilm_getLayerIDsOfScreen) {
275     t_ilm_layer layer1 = 3246;
276     t_ilm_layer layer2 = 46586;
277     t_ilm_uint roLength = 2;
278     t_ilm_layer idRenderOrder[2] = {layer1, layer2};
279     t_ilm_int length;
280     t_ilm_layer* IDs;
281 
282     ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(&layer1, 800, 480));
283     ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(&layer2, 800, 480));
284     ASSERT_EQ(ILM_SUCCESS, ilm_displaySetRenderOrder(0, idRenderOrder, roLength));
285     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
286 
287     ASSERT_EQ(ILM_SUCCESS, ilm_getLayerIDsOnScreen(0, &length, &IDs));
288 
289     EXPECT_EQ(2, length);
290     if (length == 2)
291     {
292         EXPECT_EQ(layer1, IDs[0]);
293         EXPECT_EQ(layer2, IDs[1]);
294     }
295     free(IDs);
296 }
297 
TEST_F(IlmCommandTest,ilm_getSurfaceIDs)298 TEST_F(IlmCommandTest, ilm_getSurfaceIDs) {
299     t_ilm_uint* IDs;
300     t_ilm_int length;
301     t_ilm_uint i;
302 
303     ASSERT_EQ(ILM_SUCCESS, ilm_getSurfaceIDs(&length, &IDs));
304 
305     EXPECT_EQ(iviSurfaces.size(), length);
306     for (i=0; i < iviSurfaces.size(); i++)
307     {
308         EXPECT_EQ(IDs[i], iviSurfaces[i].surface_id);
309     }
310     free(IDs);
311 }
312 
TEST_F(IlmCommandTest,ilm_layerCreate_Remove)313 TEST_F(IlmCommandTest, ilm_layerCreate_Remove) {
314     uint layer1 = 3246;
315     uint layer2 = 46586;
316     ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(&layer1, 800, 480));
317     ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(&layer2, 800, 480));
318     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
319 
320     t_ilm_int length;
321     t_ilm_uint* IDs;
322     ASSERT_EQ(ILM_SUCCESS, ilm_getLayerIDs(&length, &IDs));
323 
324     EXPECT_EQ(length, 2);
325     if (length == 2)
326     {
327         EXPECT_EQ(layer1, IDs[0]);
328         EXPECT_EQ(layer2, IDs[1]);
329     }
330     free(IDs);
331 
332     ASSERT_EQ(ILM_SUCCESS, ilm_layerRemove(layer1));
333     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
334     ASSERT_EQ(ILM_SUCCESS, ilm_getLayerIDs(&length, &IDs));
335     EXPECT_EQ(length, 1);
336     if (length == 1)
337     {
338         EXPECT_EQ(layer2, IDs[0]);
339     }
340     free(IDs);
341 
342     ASSERT_EQ(ILM_SUCCESS, ilm_layerRemove(layer2));
343     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
344     ASSERT_EQ(ILM_SUCCESS, ilm_getLayerIDs(&length, &IDs));
345     EXPECT_EQ(length, 0);
346     free(IDs);
347 }
348 
TEST_F(IlmCommandTest,ilm_layerRemove_InvalidInput)349 TEST_F(IlmCommandTest, ilm_layerRemove_InvalidInput) {
350     ASSERT_EQ(ILM_SUCCESS, ilm_layerRemove(0xdeadbeef));
351     ASSERT_EQ(ILM_ERROR_RESOURCE_NOT_FOUND, ilm_getError());
352 }
353 
TEST_F(IlmCommandTest,ilm_layerRemove_InvalidUse)354 TEST_F(IlmCommandTest, ilm_layerRemove_InvalidUse) {
355     uint layer = 0xbeef;
356     t_ilm_uint* IDs;
357     t_ilm_int orig_length;
358     t_ilm_int length;
359 
360     // get the initial number of layers
361     ASSERT_EQ(ILM_SUCCESS, ilm_getLayerIDs(&orig_length, &IDs));
362     free(IDs);
363 
364     // add the layer
365     ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(&layer, 800, 480));
366     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
367     ASSERT_EQ(ILM_SUCCESS, ilm_getLayerIDs(&length, &IDs));
368     free(IDs);
369     ASSERT_EQ(length, orig_length+1);
370 
371     // remove the new layer
372     ASSERT_EQ(ILM_SUCCESS, ilm_layerRemove(layer));
373     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
374     ASSERT_EQ(ILM_SUCCESS, ilm_getLayerIDs(&length, &IDs));
375     free(IDs);
376     ASSERT_EQ(length, orig_length);
377 
378     // try to remove the same layer once more
379     ASSERT_EQ(ILM_SUCCESS, ilm_layerRemove(layer));
380     ASSERT_EQ(ILM_ERROR_RESOURCE_NOT_FOUND, ilm_getError());
381 }
382 
TEST_F(IlmCommandTest,ilm_layerAddSurface_ilm_layerRemoveSurface_ilm_getSurfaceIDsOnLayer)383 TEST_F(IlmCommandTest, ilm_layerAddSurface_ilm_layerRemoveSurface_ilm_getSurfaceIDsOnLayer) {
384     uint layer = 3246;
385     ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(&layer, 800, 480));
386     uint surface1 = iviSurfaces[0].surface_id;
387     uint surface2 = iviSurfaces[1].surface_id;
388 
389     t_ilm_int length;
390     t_ilm_uint* IDs;
391     ASSERT_EQ(ILM_SUCCESS, ilm_getSurfaceIDsOnLayer(layer, &length, &IDs));
392     free(IDs);
393     ASSERT_EQ(length, 0);
394 
395     ASSERT_EQ(ILM_SUCCESS, ilm_layerAddSurface(layer, surface1));
396     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
397     ASSERT_EQ(ILM_SUCCESS, ilm_getSurfaceIDsOnLayer(layer, &length, &IDs));
398     EXPECT_EQ(length, 1);
399     if (length == 1)
400     {
401         EXPECT_EQ(surface1, IDs[0]);
402     }
403     free(IDs);
404 
405     ASSERT_EQ(ILM_SUCCESS, ilm_layerAddSurface(layer, surface2));
406     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
407     ASSERT_EQ(ILM_SUCCESS, ilm_getSurfaceIDsOnLayer(layer, &length, &IDs));
408     EXPECT_EQ(length, 2);
409     if (length == 2)
410     {
411        EXPECT_EQ(surface1, IDs[0]);
412        EXPECT_EQ(surface2, IDs[1]);
413     }
414     free(IDs);
415 
416     ASSERT_EQ(ILM_SUCCESS, ilm_layerRemoveSurface(layer, surface1));
417     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
418     ASSERT_EQ(ILM_SUCCESS, ilm_getSurfaceIDsOnLayer(layer, &length, &IDs));
419     EXPECT_EQ(length, 1);
420     if (length == 1)
421     {
422         EXPECT_EQ(surface2, IDs[0]);
423     }
424     free(IDs);
425 
426     ASSERT_EQ(ILM_SUCCESS, ilm_layerRemoveSurface(layer, surface2));
427     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
428     ASSERT_EQ(ILM_SUCCESS, ilm_getSurfaceIDsOnLayer(layer, &length, &IDs));
429     free(IDs);
430     ASSERT_EQ(length, 0);
431 }
432 
TEST_F(IlmCommandTest,ilm_getSurfaceIDsOnLayer_InvalidInput)433 TEST_F(IlmCommandTest, ilm_getSurfaceIDsOnLayer_InvalidInput) {
434     uint layer = 0xdeadbeef;
435 
436     t_ilm_int length;
437     t_ilm_uint* IDs;
438     ASSERT_NE(ILM_SUCCESS, ilm_getSurfaceIDsOnLayer(layer, &length, &IDs));
439 }
440 
TEST_F(IlmCommandTest,ilm_getSurfaceIDsOnLayer_InvalidResources)441 TEST_F(IlmCommandTest, ilm_getSurfaceIDsOnLayer_InvalidResources) {
442     uint layer = 3246;
443     ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(&layer, 800, 480));
444     uint surface1 = iviSurfaces[0].surface_id;
445     uint surface2 = iviSurfaces[1].surface_id;
446     uint surface3 = iviSurfaces[2].surface_id;
447 
448     t_ilm_int length;
449     t_ilm_uint IDs[3];
450     IDs[0] = surface1;
451     IDs[1] = surface2;
452     IDs[2] = surface3;
453     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetRenderOrder(layer, IDs, 3));
454     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
455 
456     ASSERT_NE(ILM_SUCCESS, ilm_getSurfaceIDsOnLayer(layer, &length, NULL));
457 }
458 
TEST_F(IlmCommandTest,ilm_getPropertiesOfSurface_ilm_surfaceSetSourceRectangle_ilm_surfaceSetDestinationRectangle)459 TEST_F(IlmCommandTest, ilm_getPropertiesOfSurface_ilm_surfaceSetSourceRectangle_ilm_surfaceSetDestinationRectangle) {
460     uint surface = iviSurfaces[0].surface_id;
461 
462     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetOpacity(surface, 0.8765));
463     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetSourceRectangle(surface, 89, 6538, 638, 4));
464     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetDestinationRectangle(surface, 54, 47, 947, 9));
465     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetVisibility(surface, true));
466     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
467 
468     ilmSurfaceProperties surfaceProperties;
469     ASSERT_EQ(ILM_SUCCESS, ilm_getPropertiesOfSurface(surface, &surfaceProperties));
470     ASSERT_NEAR(0.8765, surfaceProperties.opacity, 0.1);
471     ASSERT_EQ(89u, surfaceProperties.sourceX);
472     ASSERT_EQ(6538u, surfaceProperties.sourceY);
473     ASSERT_EQ(638u, surfaceProperties.sourceWidth);
474     ASSERT_EQ(4u, surfaceProperties.sourceHeight);
475     ASSERT_EQ(54u, surfaceProperties.destX);
476     ASSERT_EQ(47u, surfaceProperties.destY);
477     ASSERT_EQ(947u, surfaceProperties.destWidth);
478     ASSERT_EQ(9u, surfaceProperties.destHeight);
479     ASSERT_TRUE( surfaceProperties.visibility);
480     ASSERT_EQ(getpid(), surfaceProperties.creatorPid);
481 
482     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetOpacity(surface, 0.436));
483     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetSourceRectangle(surface, 784, 546, 235, 78));
484     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetDestinationRectangle(surface, 536, 5372, 3, 4316));
485     ASSERT_EQ(ILM_SUCCESS, ilm_surfaceSetVisibility(surface, false));
486     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
487 
488     ilmSurfaceProperties surfaceProperties2;
489     ASSERT_EQ(ILM_SUCCESS, ilm_getPropertiesOfSurface(surface, &surfaceProperties2));
490     ASSERT_NEAR(0.436, surfaceProperties2.opacity, 0.1);
491     ASSERT_EQ(784u, surfaceProperties2.sourceX);
492     ASSERT_EQ(546u, surfaceProperties2.sourceY);
493     ASSERT_EQ(235u, surfaceProperties2.sourceWidth);
494     ASSERT_EQ(78u, surfaceProperties2.sourceHeight);
495     ASSERT_EQ(536u, surfaceProperties2.destX);
496     ASSERT_EQ(5372u, surfaceProperties2.destY);
497     ASSERT_EQ(3u, surfaceProperties2.destWidth);
498     ASSERT_EQ(4316u, surfaceProperties2.destHeight);
499     ASSERT_FALSE(surfaceProperties2.visibility);
500 }
501 
TEST_F(IlmCommandTest,ilm_getPropertiesOfLayer_ilm_layerSetSourceRectangle_ilm_layerSetDestinationRectangle)502 TEST_F(IlmCommandTest, ilm_getPropertiesOfLayer_ilm_layerSetSourceRectangle_ilm_layerSetDestinationRectangle) {
503     t_ilm_uint layer = 0xbeef;
504     ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(&layer, 800, 480));
505     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
506 
507     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetOpacity(layer, 0.8765));
508     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetSourceRectangle(layer, 89, 6538, 638, 4));
509     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetDestinationRectangle(layer, 54, 47, 947, 9));
510     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetVisibility(layer, true));
511     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
512 
513     ilmLayerProperties layerProperties1;
514     ASSERT_EQ(ILM_SUCCESS, ilm_getPropertiesOfLayer(layer, &layerProperties1));
515     ASSERT_NEAR(0.8765, layerProperties1.opacity, 0.1);
516     ASSERT_EQ(89u, layerProperties1.sourceX);
517     ASSERT_EQ(6538u, layerProperties1.sourceY);
518     ASSERT_EQ(638u, layerProperties1.sourceWidth);
519     ASSERT_EQ(4u, layerProperties1.sourceHeight);
520     ASSERT_EQ(54u, layerProperties1.destX);
521     ASSERT_EQ(47u, layerProperties1.destY);
522     ASSERT_EQ(947u, layerProperties1.destWidth);
523     ASSERT_EQ(9u, layerProperties1.destHeight);
524     ASSERT_TRUE( layerProperties1.visibility);
525 
526     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetOpacity(layer, 0.436));
527     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetSourceRectangle(layer, 784, 546, 235, 78));
528     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetDestinationRectangle(layer, 536, 5372, 3, 4316));
529     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetVisibility(layer, false));
530     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
531 
532     ilmLayerProperties layerProperties2;
533     ASSERT_EQ(ILM_SUCCESS, ilm_getPropertiesOfLayer(layer, &layerProperties2));
534     ASSERT_NEAR(0.436, layerProperties2.opacity, 0.1);
535     ASSERT_EQ(784u, layerProperties2.sourceX);
536     ASSERT_EQ(546u, layerProperties2.sourceY);
537     ASSERT_EQ(235u, layerProperties2.sourceWidth);
538     ASSERT_EQ(78u, layerProperties2.sourceHeight);
539     ASSERT_EQ(536u, layerProperties2.destX);
540     ASSERT_EQ(5372u, layerProperties2.destY);
541     ASSERT_EQ(3u, layerProperties2.destWidth);
542     ASSERT_EQ(4316u, layerProperties2.destHeight);
543     ASSERT_FALSE(layerProperties2.visibility);
544 }
545 
TEST_F(IlmCommandTest,ilm_getPropertiesOfSurface_InvalidInput)546 TEST_F(IlmCommandTest, ilm_getPropertiesOfSurface_InvalidInput) {
547     ilmSurfaceProperties surfaceProperties;
548     ASSERT_NE(ILM_SUCCESS, ilm_getPropertiesOfSurface(0xdeadbeef, &surfaceProperties));
549 }
550 
TEST_F(IlmCommandTest,ilm_takeScreenshot)551 TEST_F(IlmCommandTest, ilm_takeScreenshot) {
552     const char* outputFile = "/tmp/test.bmp";
553     // make sure the file is not there before
554     FILE* f = fopen(outputFile, "r");
555     if (f!=NULL){
556         fclose(f);
557         int result = remove(outputFile);
558         ASSERT_EQ(0, result);
559     }
560 
561     ASSERT_EQ(ILM_SUCCESS, ilm_takeScreenshot(0, outputFile));
562 
563     f = fopen(outputFile, "r");
564     ASSERT_TRUE(f!=NULL);
565     fclose(f);
566     remove(outputFile);
567 }
568 
TEST_F(IlmCommandTest,ilm_takeScreenshot_InvalidInputs)569 TEST_F(IlmCommandTest, ilm_takeScreenshot_InvalidInputs) {
570     const char* outputFile = "/tmp/test.bmp";
571     // make sure the file is not there before
572     FILE* f = fopen(outputFile, "r");
573     if (f!=NULL){
574         fclose(f);
575         ASSERT_EQ(0, remove(outputFile));
576     }
577 
578     // try to dump an non-existing screen
579     ASSERT_NE(ILM_SUCCESS, ilm_takeScreenshot(0xdeadbeef, outputFile));
580 
581     // make sure, no screen dump file was created for invalid screen
582     ASSERT_NE(0, remove(outputFile));
583 }
584 
TEST_F(IlmCommandTest,ilm_takeSurfaceScreenshot)585 TEST_F(IlmCommandTest, ilm_takeSurfaceScreenshot) {
586     const char* outputFile = "/tmp/test.bmp";
587     // make sure the file is not there before
588     FILE* f = fopen(outputFile, "r");
589     if (f!=NULL){
590         fclose(f);
591         int result = remove(outputFile);
592         ASSERT_EQ(0, result);
593     }
594 
595     uint surface = iviSurfaces[0].surface_id;
596     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
597     ASSERT_EQ(ILM_SUCCESS, ilm_takeSurfaceScreenshot(outputFile, surface));
598 
599     f = fopen(outputFile, "r");
600     ASSERT_TRUE(f!=NULL);
601     fclose(f);
602     remove(outputFile);
603 }
604 
TEST_F(IlmCommandTest,ilm_takeSurfaceScreenshot_InvalidInputs)605 TEST_F(IlmCommandTest, ilm_takeSurfaceScreenshot_InvalidInputs) {
606     const char* outputFile = "/tmp/test.bmp";
607     // make sure the file is not there before
608     FILE* f = fopen(outputFile, "r");
609     if (f!=NULL){
610         fclose(f);
611         ASSERT_EQ(0, remove(outputFile));
612     }
613 
614     // try to dump an non-existing screen
615     ASSERT_EQ(ILM_FAILED, ilm_takeSurfaceScreenshot(outputFile, 0xdeadbeef));
616 
617     // make sure, no screen dump file was created for invalid screen
618     ASSERT_NE(0, remove(outputFile));
619 }
620 
TEST_F(IlmCommandTest,ilm_getPropertiesOfScreen)621 TEST_F(IlmCommandTest, ilm_getPropertiesOfScreen) {
622     t_ilm_uint numberOfScreens;
623     t_ilm_uint* screenIDs;
624     ASSERT_EQ(ILM_SUCCESS, ilm_getScreenIDs(&numberOfScreens, &screenIDs));
625     EXPECT_TRUE(numberOfScreens>0);
626 
627     if (numberOfScreens > 0)
628     {
629         t_ilm_display screen = screenIDs[0];
630         ilmScreenProperties screenProperties;
631 
632         t_ilm_layer layerIds[3] = {100, 200, 300};//t_ilm_layer layerIds[3] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
633         EXPECT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(layerIds, 800, 480));
634         EXPECT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(layerIds + 1, 800, 480));
635         EXPECT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(layerIds + 2, 800, 480));
636 
637         EXPECT_EQ(ILM_SUCCESS, ilm_commitChanges());
638 
639         EXPECT_EQ(ILM_SUCCESS, ilm_displaySetRenderOrder(screen, layerIds, 3));
640 
641         EXPECT_EQ(ILM_SUCCESS, ilm_commitChanges());
642 
643 
644         EXPECT_EQ(ILM_SUCCESS, ilm_getPropertiesOfScreen(screen, &screenProperties));
645         EXPECT_EQ(3, screenProperties.layerCount);
646         if (screenProperties.layerCount == 3)
647         {
648             EXPECT_EQ(layerIds[0], screenProperties.layerIds[0]);
649             EXPECT_EQ(layerIds[1], screenProperties.layerIds[1]);
650             EXPECT_EQ(layerIds[2], screenProperties.layerIds[2]);
651         }
652         free(screenProperties.layerIds);
653 
654         EXPECT_GT(screenProperties.screenWidth, 0u);
655         EXPECT_GT(screenProperties.screenHeight, 0u);
656     }
657 
658     free(screenIDs);
659 }
660 
TEST_F(IlmCommandTest,DisplaySetRenderOrder_growing)661 TEST_F(IlmCommandTest, DisplaySetRenderOrder_growing) {
662     //prepare needed layers
663     t_ilm_layer renderOrder[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
664     t_ilm_uint layerCount = sizeof(renderOrder) / sizeof(renderOrder[0]);
665 
666     for (unsigned int i = 0; i < layerCount; ++i)
667     {
668         ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(renderOrder + i, 300, 300));
669         ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
670     }
671 
672     t_ilm_display* screenIDs;
673     t_ilm_uint screenCount;
674     ASSERT_EQ(ILM_SUCCESS, ilm_getScreenIDs(&screenCount, &screenIDs));
675 
676     for(unsigned int i = 0; i < screenCount; ++i)
677     {
678         t_ilm_display screen = screenIDs[i];
679         ilmScreenProperties screenProps;
680 
681         //trying different render orders with increasing sizes
682         for (unsigned int j = layerCount; j <= layerCount; --j) // note: using overflow here
683         {
684             //put them from end to beginning, so that in each loop iteration the order of layers change
685             EXPECT_EQ(ILM_SUCCESS, ilm_displaySetRenderOrder(screen, renderOrder + j, layerCount - j));
686             EXPECT_EQ(ILM_SUCCESS, ilm_commitChanges());
687             EXPECT_EQ(ILM_SUCCESS, ilm_getPropertiesOfScreen(screen, &screenProps));
688 
689             EXPECT_EQ(layerCount - j, screenProps.layerCount);
690             if (layerCount - j == screenProps.layerCount)
691                 for(unsigned int k = 0; k < layerCount - j; ++k)
692                 {
693                     EXPECT_EQ(renderOrder[j + k], screenProps.layerIds[k]);
694                 }
695             free(screenProps.layerIds);
696         }
697     }
698 
699     free(screenIDs);
700 }
701 
TEST_F(IlmCommandTest,DisplaySetRenderOrder_shrinking)702 TEST_F(IlmCommandTest, DisplaySetRenderOrder_shrinking) {
703     //prepare needed layers
704     t_ilm_layer renderOrder[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
705     t_ilm_uint layerCount = sizeof(renderOrder) / sizeof(renderOrder[0]);
706 
707     for (unsigned int i = 0; i < layerCount; ++i)
708     {
709         ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(renderOrder + i, 300, 300));
710         ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
711     }
712 
713     t_ilm_display* screenIDs;
714     t_ilm_uint screenCount;
715     ASSERT_EQ(ILM_SUCCESS, ilm_getScreenIDs(&screenCount, &screenIDs));
716 
717     for(unsigned int i = 0; i < screenCount; ++i)
718     {
719         t_ilm_display screen = screenIDs[i];
720         ilmScreenProperties screenProps;
721 
722         //trying different render orders with decreasing sizes
723         for (unsigned int j = 0; j < layerCount; ++j)
724         {
725             //put them from end to beginning, so that in each loop iteration the order of layers change
726             EXPECT_EQ(ILM_SUCCESS, ilm_displaySetRenderOrder(screen, renderOrder + j, layerCount - j));
727             EXPECT_EQ(ILM_SUCCESS, ilm_commitChanges());
728             EXPECT_EQ(ILM_SUCCESS, ilm_getPropertiesOfScreen(screen, &screenProps));
729 
730             EXPECT_EQ(layerCount - j, screenProps.layerCount);
731             if (layerCount - j == screenProps.layerCount)
732                 for(unsigned int k = 0; k < layerCount - j; ++k)
733                 {
734                     ASSERT_EQ(renderOrder[j + k], screenProps.layerIds[k]);
735                 }
736             free(screenProps.layerIds);
737         }
738     }
739 
740     free(screenIDs);
741 }
742 
TEST_F(IlmCommandTest,LayerSetRenderOrder_growing)743 TEST_F(IlmCommandTest, LayerSetRenderOrder_growing) {
744     //prepare needed layers and surfaces
745     unsigned int renderOrder[] = {0, 0, 0};
746     t_ilm_uint surfaceCount = 3;
747 
748     for (unsigned int i = 0; i < surfaceCount; ++i)
749     {
750         renderOrder[i] = iviSurfaces[i].surface_id;
751     }
752 
753     t_ilm_layer layerIDs[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
754     t_ilm_uint layerCount = sizeof(layerIDs) / sizeof(layerIDs[0]);
755 
756     for (unsigned int i = 0; i < layerCount; ++i)
757     {
758         ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(layerIDs + i, 300, 300));
759         ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
760     }
761 
762     for(unsigned int i = 0; i < layerCount; ++i)
763     {
764         t_ilm_layer layer = layerIDs[i];
765 
766         t_ilm_int layerSurfaceCount;
767         t_ilm_surface* layerSurfaceIDs;
768 
769         //trying different render orders with increasing sizes
770         for (unsigned int j = surfaceCount; j <= surfaceCount; --j) // note: using overflow here
771         {
772             //put them from end to beginning, so that in each loop iteration the order of surafces change
773             EXPECT_EQ(ILM_SUCCESS, ilm_layerSetRenderOrder(layer, renderOrder + j, surfaceCount - j));
774             EXPECT_EQ(ILM_SUCCESS, ilm_commitChanges());
775             EXPECT_EQ(ILM_SUCCESS, ilm_getSurfaceIDsOnLayer(layer, &layerSurfaceCount, &layerSurfaceIDs));
776 
777             EXPECT_EQ(surfaceCount - j, layerSurfaceCount);
778             if (surfaceCount - j == (unsigned int) layerSurfaceCount)
779                 for(unsigned int k = 0; k < surfaceCount - j; ++k)
780                 {
781                     ASSERT_EQ(renderOrder[j + k], layerSurfaceIDs[k]);
782                 }
783             free(layerSurfaceIDs);
784         }
785 
786         //set empty render order again
787         EXPECT_EQ(ILM_SUCCESS, ilm_layerSetRenderOrder(layer, renderOrder, 0));
788         EXPECT_EQ(ILM_SUCCESS, ilm_commitChanges());
789     }
790 }
791 
TEST_F(IlmCommandTest,LayerSetRenderOrder_shrinking)792 TEST_F(IlmCommandTest, LayerSetRenderOrder_shrinking) {
793     //prepare needed layers and surfaces
794     unsigned int renderOrder[] = {0, 0, 0};
795     t_ilm_uint surfaceCount = 3;
796 
797     for (unsigned int i = 0; i < surfaceCount; ++i)
798     {
799         renderOrder[i] = iviSurfaces[i].surface_id;
800     }
801 
802     t_ilm_layer layerIDs[] = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
803     t_ilm_uint layerCount = sizeof(layerIDs) / sizeof(layerIDs[0]);
804 
805     for (unsigned int i = 0; i < layerCount; ++i)
806     {
807         ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(layerIDs + i, 300, 300));
808         ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
809     }
810 
811     for(unsigned int i = 0; i < layerCount; ++i)
812     {
813         t_ilm_layer layer = layerIDs[i];
814 
815         t_ilm_int layerSurfaceCount;
816         t_ilm_surface* layerSurfaceIDs;
817 
818         //trying different render orders with decreasing sizes
819         for (unsigned int j = 0; j < layerCount; ++j)
820         {
821             //put them from end to beginning, so that in each loop iteration the order of surafces change
822             EXPECT_EQ(ILM_SUCCESS, ilm_layerSetRenderOrder(layer, renderOrder + j, surfaceCount - j));
823             EXPECT_EQ(ILM_SUCCESS, ilm_commitChanges());
824             EXPECT_EQ(ILM_SUCCESS, ilm_getSurfaceIDsOnLayer(layer, &layerSurfaceCount, &layerSurfaceIDs));
825 
826             EXPECT_EQ(surfaceCount - j, layerSurfaceCount);
827             if (surfaceCount - j == (unsigned int)layerSurfaceCount)
828                 for(unsigned int k = 0; k < surfaceCount - j; ++k)
829                 {
830                     EXPECT_EQ(renderOrder[j + k], layerSurfaceIDs[k]);
831                 }
832             free(layerSurfaceIDs);
833         }
834 
835         //set empty render order again
836         EXPECT_EQ(ILM_SUCCESS, ilm_layerSetRenderOrder(layer, renderOrder, 0));
837         EXPECT_EQ(ILM_SUCCESS, ilm_commitChanges());
838     }
839 }
840 
TEST_F(IlmCommandTest,LayerSetRenderOrder_duplicates)841 TEST_F(IlmCommandTest, LayerSetRenderOrder_duplicates) {
842     //prepare needed layers and surfaces
843     unsigned int renderOrder[] = {0, 0, 0};
844     t_ilm_uint surfaceCount = 3;
845 
846     for (unsigned int i = 0; i < surfaceCount; ++i)
847     {
848         renderOrder[i] = iviSurfaces[i].surface_id;
849     }
850 
851     t_ilm_surface duplicateRenderOrder[] = {renderOrder[0], renderOrder[1], renderOrder[0], renderOrder[1], renderOrder[0]};
852     t_ilm_int duplicateSurfaceCount = sizeof(duplicateRenderOrder) / sizeof(duplicateRenderOrder[0]);
853 
854     t_ilm_layer layer = 0xFFFFFFFF;
855     ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(&layer, 300, 300));
856     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
857 
858     t_ilm_int layerSurfaceCount;
859     t_ilm_surface* layerSurfaceIDs;
860 
861     //trying duplicates
862     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetRenderOrder(layer, duplicateRenderOrder, duplicateSurfaceCount));
863     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
864     ASSERT_EQ(ILM_SUCCESS, ilm_getSurfaceIDsOnLayer(layer, &layerSurfaceCount, &layerSurfaceIDs));
865     free(layerSurfaceIDs);
866 
867     ASSERT_EQ(2, layerSurfaceCount);
868 }
869 
TEST_F(IlmCommandTest,LayerSetRenderOrder_empty)870 TEST_F(IlmCommandTest, LayerSetRenderOrder_empty) {
871     //prepare needed layers and surfaces
872     unsigned int renderOrder[] = {0, 0, 0};
873     t_ilm_uint surfaceCount = 3;
874 
875     for (unsigned int i = 0; i < surfaceCount; ++i)
876     {
877         renderOrder[i] = iviSurfaces[i].surface_id;
878     }
879 
880     t_ilm_layer layer = 0xFFFFFFFF;
881     ASSERT_EQ(ILM_SUCCESS, ilm_layerCreateWithDimension(&layer, 300, 300));
882     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
883 
884     t_ilm_int layerSurfaceCount;
885     t_ilm_surface* layerSurfaceIDs;
886 
887     //test start
888     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetRenderOrder(layer, renderOrder, surfaceCount));
889     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
890 
891     //set empty render order
892     ASSERT_EQ(ILM_SUCCESS, ilm_layerSetRenderOrder(layer, renderOrder, 0));
893     ASSERT_EQ(ILM_SUCCESS, ilm_commitChanges());
894     ASSERT_EQ(ILM_SUCCESS, ilm_getSurfaceIDsOnLayer(layer, &layerSurfaceCount, &layerSurfaceIDs));
895     free(layerSurfaceIDs);
896 
897     ASSERT_EQ(0, layerSurfaceCount);
898 }
899