/***************************************************************************
*
* Copyright 2010,2011 BMW Car IT GmbH
+ * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
*
* ilm_displaySetRenderOrder
* ilm_surfaceInvalidateRectangle
- * ilm_surfaceSetChromaKey
* ilm_layerSetChromaKey
* ilm_layerSetRenderOrder
* ilm_getNumberOfHardwareLayers
ASSERT_EQ(length,0);
}
-TEST_F(IlmCommandTest, ilm_getPropertiesOfSurface_ilm_surfaceSetSourceRectangle_ilm_surfaceSetDestinationRectangle) {
+TEST_F(IlmCommandTest, ilm_getPropertiesOfSurface_ilm_surfaceSetSourceRectangle_ilm_surfaceSetDestinationRectangle_ilm_surfaceSetChromaKey) {
t_ilm_uint surface;
+ t_ilm_int chromaKey[3] = {3, 22, 111};
ilm_surfaceCreate(0,0,0,ILM_PIXELFORMAT_RGBA_8888,&surface);
ilm_commitChanges();
ilm_surfaceSetDestinationRectangle(surface,54,47,947,9);
ilm_surfaceSetOrientation(surface,ILM_NINETY);
ilm_surfaceSetVisibility(surface,true);
+ ilm_surfaceSetChromaKey(surface,&chromaKey[0]);
ilm_commitChanges();
ilmSurfaceProperties surfaceProperties;
ASSERT_EQ(9u, surfaceProperties.destHeight);
ASSERT_EQ(ILM_NINETY, surfaceProperties.orientation);
ASSERT_TRUE( surfaceProperties.visibility);
+ ASSERT_TRUE( surfaceProperties.chromaKeyEnabled);
+ ASSERT_EQ(3u, surfaceProperties.chromaKeyRed);
+ ASSERT_EQ(22u, surfaceProperties.chromaKeyGreen);
+ ASSERT_EQ(111u, surfaceProperties.chromaKeyBlue);
ilm_surfaceSetOpacity(surface,0.436);
ilm_surfaceSetSourceRectangle(surface,784,546,235,78);
ilm_surfaceSetDestinationRectangle(surface,536,5372,3,4316);
ilm_surfaceSetOrientation(surface,ILM_TWOHUNDREDSEVENTY);
ilm_surfaceSetVisibility(surface,false);
+ ilm_surfaceSetChromaKey(surface,NULL);
ilm_commitChanges();
ilmSurfaceProperties surfaceProperties2;
ASSERT_EQ(4316u, surfaceProperties2.destHeight);
ASSERT_EQ(ILM_TWOHUNDREDSEVENTY, surfaceProperties2.orientation);
ASSERT_FALSE(surfaceProperties2.visibility);
+ ASSERT_FALSE(surfaceProperties2.chromaKeyEnabled);
}
TEST_F(IlmCommandTest, ilm_getPropertiesOfLayer_ilm_layerSetSourceRectangle_ilm_layerSetDestinationRectangle) {
/***************************************************************************
*
* Copyright 2010,2011 BMW Car IT GmbH
+ * Copyright (C) 2012 DENSO CORPORATION and Robert Bosch Car Multimedia Gmbh
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
{
unsigned int expectedOpacity = 0.3;
unsigned int expectedVisibility = 0;
+ unsigned int expectedChromaKeyEnabled = 0;
+ unsigned char expectedChromaKeyRed = 0;
+ unsigned char expectedChromaKeyGreen = 0;
+ unsigned char expectedChromaKeyBlue = 0;
+ unsigned char chromaKeyRed = 3;
+ unsigned char chromaKeyGreen = 22;
+ unsigned char chromaKeyBlue = 111;
/// Create graphical object of type surface without specific id
GraphicalObject surface(TypeSurface, expectedOpacity, expectedVisibility);
/// make sure, surface has expected visibility
EXPECT_EQ(expectedVisibility, surface.getVisibility());
+
+ /// make sure, surface has expected chromaKeyEnabled
+ EXPECT_EQ(expectedChromaKeyEnabled, surface.getChromaKeyEnabled());
+
+ /// make sure, surface has expected chromaKey
+ surface.getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
+ EXPECT_EQ(expectedChromaKeyRed, chromaKeyRed);
+ EXPECT_EQ(expectedChromaKeyGreen, chromaKeyGreen);
+ EXPECT_EQ(expectedChromaKeyBlue, chromaKeyBlue);
}
TEST_F(GraphicalObjectTest, constructor_LayerWithId)
unsigned int expectedOpacity = 0.7;
unsigned int expectedVisibility = 1;
unsigned int expectedId = 411;
+ unsigned int expectedChromaKeyEnabled = 0;
+ unsigned char expectedChromaKeyRed = 0;
+ unsigned char expectedChromaKeyGreen = 0;
+ unsigned char expectedChromaKeyBlue = 0;
+ unsigned char chromaKeyRed = 3;
+ unsigned char chromaKeyGreen = 22;
+ unsigned char chromaKeyBlue = 111;
/// Create graphical object of type surface without specific id
GraphicalObject surface(expectedId, TypeSurface, expectedOpacity, expectedVisibility);
/// make sure, surface has expected visibility
EXPECT_EQ(expectedVisibility, surface.getVisibility());
+
+ /// make sure, surface has expected chromaKeyEnabled
+ EXPECT_EQ(expectedChromaKeyEnabled, surface.getChromaKeyEnabled());
+
+ /// make sure, surface has expected chromaKey
+ surface.getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
+ EXPECT_EQ(expectedChromaKeyRed, chromaKeyRed);
+ EXPECT_EQ(expectedChromaKeyGreen, chromaKeyGreen);
+ EXPECT_EQ(expectedChromaKeyBlue, chromaKeyBlue);
}
TEST_F(GraphicalObjectTest, setOpacity_Layer)
EXPECT_EQ(expectedSurfaceId, surface.getID());
}
+TEST_F(GraphicalObjectTest, setChromaKeyEnabled_Surface)
+{
+ /// set surface to enable chromakey
+ m_pSurface->setChromaKeyEnabled(true);
+
+ /// make sure, surface has expected chromakey enabled
+ EXPECT_TRUE(m_pSurface->getChromaKeyEnabled());
+
+ /// set surface to disable chromakey
+ m_pSurface->setChromaKeyEnabled(false);
+
+ /// make sure, surface has expected
+ EXPECT_FALSE(m_pSurface->getChromaKeyEnabled());
+}
+
+TEST_F(GraphicalObjectTest, getChromaKeyEnabled_Surface)
+{
+ /// set surface to enable chromakey
+ m_pSurface->setChromaKeyEnabled(true);
+
+ /// make sure, surface has expected chromakey enabled
+ EXPECT_TRUE(m_pSurface->getChromaKeyEnabled());
+
+ /// set surface to disable chromakey
+ m_pSurface->setChromaKeyEnabled(false);
+
+ /// make sure, surface has expected chromakey enabled
+ EXPECT_FALSE(m_pSurface->getChromaKeyEnabled());
+}
+
+TEST_F(GraphicalObjectTest, setChromaKey_Surface)
+{
+ unsigned char expectedChromaKeyRed = 3;
+ unsigned char expectedChromaKeyGreen = 22;
+ unsigned char expectedChromaKeyBlue = 111;
+ unsigned char chromaKeyRed = 0xFF;
+ unsigned char chromaKeyGreen = 0xFF;
+ unsigned char chromaKeyBlue = 0xFF;
+
+ /// make sure, surface has default chromakey
+ m_pSurface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
+ EXPECT_EQ(0, chromaKeyRed);
+ EXPECT_EQ(0, chromaKeyGreen);
+ EXPECT_EQ(0, chromaKeyBlue);
+
+ /// set chromakey of surface to expected value
+ m_pSurface->setChromaKey(expectedChromaKeyRed,
+ expectedChromaKeyGreen,
+ expectedChromaKeyBlue);
+
+ /// make sure, surface has expected chromakey
+ m_pSurface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
+ EXPECT_EQ(expectedChromaKeyRed, chromaKeyRed);
+ EXPECT_EQ(expectedChromaKeyGreen, chromaKeyGreen);
+ EXPECT_EQ(expectedChromaKeyBlue, chromaKeyBlue);
+}
+
+TEST_F(GraphicalObjectTest, getChromaKey_Surface)
+{
+ unsigned char expectedChromaKeyRed = 3;
+ unsigned char expectedChromaKeyGreen = 22;
+ unsigned char expectedChromaKeyBlue = 111;
+ unsigned char chromaKeyRed = 0xFF;
+ unsigned char chromaKeyGreen = 0xFF;
+ unsigned char chromaKeyBlue = 0xFF;
+
+ /// make sure, surface has default chromakey
+ m_pSurface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
+ EXPECT_EQ(0, chromaKeyRed);
+ EXPECT_EQ(0, chromaKeyGreen);
+ EXPECT_EQ(0, chromaKeyBlue);
+
+ /// set chromakey of surface to expected value
+ m_pSurface->setChromaKey(expectedChromaKeyRed,
+ expectedChromaKeyGreen,
+ expectedChromaKeyBlue);
+
+ /// make sure, surface has expected chromakey
+ m_pSurface->getChromaKey(chromaKeyRed, chromaKeyGreen, chromaKeyBlue);
+ EXPECT_EQ(expectedChromaKeyRed, chromaKeyRed);
+ EXPECT_EQ(expectedChromaKeyGreen, chromaKeyGreen);
+ EXPECT_EQ(expectedChromaKeyBlue, chromaKeyBlue);
+}
+
TEST_F(GraphicalObjectTest, DISABLED_setShader)
{
// TODO: requires Shader object and shader code in files