TEST_F(NotificationTest, MultipleRegistrationsLayer) { ASSERT_EQ(ILM_SUCCESS,ilm_layerAddNotification(layer,&LayerCallbackFunction)); // get called once ilm_layerSetOrientation(layer,ILM_ONEHUNDREDEIGHTY); ilm_commitChanges(); assertCallbackcalled(); ASSERT_EQ(ILM_SUCCESS,ilm_layerRemoveNotification(layer)); // change a lot of things t_ilm_float opacity = 0.789; ilm_layerSetOpacity(layer,opacity); ilm_layerSetVisibility(layer,true); ilm_layerSetDestinationRectangle(layer,133,1567,155,199); ilm_layerSetSourceRectangle(layer,33,567,55,99); ilm_layerSetOrientation(layer,ILM_ONEHUNDREDEIGHTY); ilm_commitChanges(); // assert that we have not been notified assertNoCallbackIsCalled(); // register for notifications again ASSERT_EQ(ILM_SUCCESS,ilm_layerAddNotification(layer,&LayerCallbackFunction)); ilm_layerSetOrientation(layer,ILM_ZERO); ilm_commitChanges(); assertCallbackcalled(); ASSERT_EQ(ILM_SUCCESS,ilm_layerRemoveNotification(layer)); }
TEST_F(NotificationTest, NotifyOnLayerAllValues) { ASSERT_EQ(ILM_SUCCESS,ilm_layerAddNotification(layer,&LayerCallbackFunction)); // change something t_ilm_float opacity = 0.789; ilm_layerSetOpacity(layer,opacity); ilm_layerSetVisibility(layer,true); ilm_layerSetDestinationRectangle(layer,133,1567,155,199); ilm_layerSetSourceRectangle(layer,33,567,55,99); ilm_layerSetOrientation(layer,ILM_ONEHUNDREDEIGHTY); ilm_commitChanges(); // expect callback to have been called assertCallbackcalled(); EXPECT_EQ(layer,callbackLayerId); EXPECT_EQ(33u,LayerProperties.sourceX); EXPECT_EQ(567u,LayerProperties.sourceY); EXPECT_EQ(55u,LayerProperties.sourceWidth); EXPECT_EQ(99u,LayerProperties.sourceHeight); EXPECT_EQ(ILM_ONEHUNDREDEIGHTY,LayerProperties.orientation); EXPECT_TRUE(LayerProperties.visibility); EXPECT_NEAR(opacity, LayerProperties.opacity, 0.1); EXPECT_EQ(133u,LayerProperties.destX); EXPECT_EQ(1567u,LayerProperties.destY); EXPECT_EQ(155u,LayerProperties.destWidth); EXPECT_EQ(199u,LayerProperties.destHeight); EXPECT_EQ(ILM_NOTIFICATION_DEST_RECT|ILM_NOTIFICATION_VISIBILITY|ILM_NOTIFICATION_OPACITY|ILM_NOTIFICATION_SOURCE_RECT|ILM_NOTIFICATION_ORIENTATION,mask); ASSERT_EQ(ILM_SUCCESS,ilm_layerRemoveNotification(layer)); }
TEST_F(NotificationTest, NotifyOnLayerSetVisibility) { ASSERT_EQ(ILM_SUCCESS,ilm_layerAddNotification(layer,&LayerCallbackFunction)); // change something t_ilm_bool value = ILM_TRUE; ilm_layerSetVisibility(layer,value); ilm_commitChanges(); // expect callback to have been called assertCallbackcalled(); EXPECT_EQ(layer,callbackLayerId); EXPECT_TRUE(LayerProperties.visibility); EXPECT_EQ(ILM_NOTIFICATION_VISIBILITY,mask); ASSERT_EQ(ILM_SUCCESS,ilm_layerRemoveNotification(layer)); }
TEST_F(NotificationTest, NotifyOnLayerSetOrientation) { ASSERT_EQ(ILM_SUCCESS,ilm_layerAddNotification(layer,&LayerCallbackFunction)); // change something e_ilmOrientation orientation = ILM_ONEHUNDREDEIGHTY; ilm_layerSetOrientation(layer,orientation); ilm_commitChanges(); // expect callback to have been called assertCallbackcalled(); EXPECT_EQ(layer,callbackLayerId); EXPECT_EQ(ILM_ONEHUNDREDEIGHTY,LayerProperties.orientation); EXPECT_EQ(ILM_NOTIFICATION_ORIENTATION,mask); ASSERT_EQ(ILM_SUCCESS,ilm_layerRemoveNotification(layer)); }
TEST_F(NotificationTest, NotifyOnLayerSetOpacity) { ASSERT_EQ(ILM_SUCCESS,ilm_layerAddNotification(layer,&LayerCallbackFunction)); // change something t_ilm_float opacity = 0.789; ilm_layerSetOpacity(layer,opacity); ilm_commitChanges(); // expect callback to have been called assertCallbackcalled(); EXPECT_EQ(layer,callbackLayerId); EXPECT_NEAR(0.789, LayerProperties.opacity, 0.1); EXPECT_EQ(ILM_NOTIFICATION_OPACITY,mask); ASSERT_EQ(ILM_SUCCESS,ilm_layerRemoveNotification(layer)); }
TEST_F(NotificationTest, NotifyOnLayerSetSourceRectangle) { ASSERT_EQ(ILM_SUCCESS,ilm_layerAddNotification(layer,&LayerCallbackFunction)); // change something ilm_layerSetSourceRectangle(layer,33,567,55,99); ilm_commitChanges(); // expect callback to have been called assertCallbackcalled(); EXPECT_EQ(layer,callbackLayerId); EXPECT_EQ(33u,LayerProperties.sourceX); EXPECT_EQ(567u,LayerProperties.sourceY); EXPECT_EQ(55u,LayerProperties.sourceWidth); EXPECT_EQ(99u,LayerProperties.sourceHeight); EXPECT_EQ(ILM_NOTIFICATION_SOURCE_RECT,mask); ASSERT_EQ(ILM_SUCCESS,ilm_layerRemoveNotification(layer)); }
TEST_F(NotificationTest, NotifyOnLayerSetDimension) { ASSERT_EQ(ILM_SUCCESS,ilm_layerAddNotification(layer,&LayerCallbackFunction)); // change something t_ilm_uint* pos = new t_ilm_uint[2]; pos[0] = 70; pos[1] = 22; ilm_layerSetDimension(layer,pos); ilm_commitChanges(); // expect callback to have been called assertCallbackcalled(); EXPECT_EQ(layer,callbackLayerId); EXPECT_EQ(70u,LayerProperties.destWidth); EXPECT_EQ(22u,LayerProperties.destHeight); EXPECT_EQ(ILM_NOTIFICATION_DEST_RECT,mask); ASSERT_EQ(ILM_SUCCESS,ilm_layerRemoveNotification(layer)); }
TEST_F(NotificationTest, NotifyOnLayerMultipleValues2) { ASSERT_EQ(ILM_SUCCESS,ilm_layerAddNotification(layer,&LayerCallbackFunction)); // change something t_ilm_float opacity = 0.789; ilm_layerSetOpacity(layer,opacity); ilm_layerSetVisibility(layer,true); ilm_layerSetDestinationRectangle(layer,33,567,55,99); ilm_commitChanges(); // expect callback to have been called assertCallbackcalled(); EXPECT_EQ(layer,callbackLayerId); EXPECT_TRUE(LayerProperties.visibility); EXPECT_NEAR(0.789, LayerProperties.opacity, 0.1); EXPECT_EQ(33u,LayerProperties.destX); EXPECT_EQ(567u,LayerProperties.destY); EXPECT_EQ(55u,LayerProperties.destWidth); EXPECT_EQ(99u,LayerProperties.destHeight); EXPECT_EQ(ILM_NOTIFICATION_DEST_RECT|ILM_NOTIFICATION_VISIBILITY|ILM_NOTIFICATION_OPACITY,mask); ASSERT_EQ(ILM_SUCCESS,ilm_layerRemoveNotification(layer)); }