void testCheckedProperty() { TESTIFY_ASSERT_EQUAL( maWidgetSetProperty( getTestWidgetHandle( ), MAW_TOGGLE_BUTTON_CHECKED, "false" ), MAW_RES_OK ); char checkedBuffer[256]; TESTIFY_ASSERT_EQUAL( maWidgetGetProperty( getTestWidgetHandle( ), MAW_TOGGLE_BUTTON_CHECKED, checkedBuffer, 256 ), strlen( "false" ) ); TESTIFY_ASSERT_EQUAL( strcmp( checkedBuffer, "false" ), 0 ); TESTIFY_ASSERT_EQUAL( maWidgetGetProperty( getTestWidgetHandle( ), MAW_TOGGLE_BUTTON_CHECKED, checkedBuffer, 1 ), MAW_RES_INVALID_STRING_BUFFER_SIZE ); }
/** * Tests to insert an element at the end of a list. */ void testInsertLast() { int listView = maWidgetCreate( MAW_LIST_VIEW ); TESTIFY_ASSERT( listView > 0 ); int firstChild = maWidgetCreate( MAW_LABEL ); TESTIFY_ASSERT( firstChild > 0 ); TESTIFY_ASSERT_EQUAL( maWidgetInsertChild( listView, firstChild, 0 ), MAW_RES_OK ); int secondChild = maWidgetCreate( MAW_LABEL ); TESTIFY_ASSERT( secondChild > 0 ); TESTIFY_ASSERT_EQUAL( maWidgetInsertChild( listView, secondChild, -1 ), MAW_RES_OK ); maWidgetDestroy( listView ); }
/** * Tests to add and remove children from the layout. */ void testAddAndRemoveChildren() { MAWidgetHandle children[ 10 ]; for(int i = 0; i < NUM_CHILDREN; i++) { children[ i ] = maWidgetCreate( MAW_LABEL ); TESTIFY_ASSERT( children[ i ] >= 0 ); TESTIFY_ASSERT_EQUAL( maWidgetAddChild( getTestWidgetHandle( ), children[ i ] ), MAW_RES_OK ); } for(int i = 0; i < NUM_CHILDREN; i++) { TESTIFY_ASSERT_EQUAL( maWidgetRemoveChild( children[ i ] ), MAW_RES_OK ); TESTIFY_ASSERT_EQUAL( maWidgetDestroy( children[ i ] ), MAW_RES_OK ); } }
/** * The purpose of this test is to test the creation and destruction * of a screen. */ void createWidget(const char *type) { int widgetHandle = maWidgetCreate( type ); TESTIFY_ASSERT_NOT_EQUAL( widgetHandle, MAW_RES_INVALID_TYPE_NAME ); TESTIFY_ASSERT( widgetHandle >= 0 ); int destroyStatus = maWidgetDestroy( widgetHandle ); TESTIFY_ASSERT_EQUAL( destroyStatus, MAW_RES_OK ); }
void WidgetTest::testTearDown(void) { TESTIFY_ASSERT( m_testWidgetHandle >= 0 ); TESTIFY_ASSERT_EQUAL( maWidgetDestroy( m_testWidgetHandle ), MAW_RES_OK ); m_testWidgetHandle = -1; // Keep default behavior Testify::TestCase::testTearDown( ); }
/** * Tests to insert an element at a bad index. */ void testBadInsert() { int listView = maWidgetCreate( MAW_LIST_VIEW ); TESTIFY_ASSERT( listView > 0 ); int firstChild = maWidgetCreate( MAW_LABEL ); TESTIFY_ASSERT( firstChild > 0 ); TESTIFY_ASSERT_EQUAL( maWidgetInsertChild( listView, firstChild, -515 ), MAW_RES_INVALID_INDEX ); maWidgetDestroy( listView ); }
/** * The purpose of this test is to test all properties that * you can set on a screen. */ void testIconProperty() { TESTIFY_ASSERT_EQUAL( maWidgetSetProperty( getTestWidgetHandle( ), MAW_LIST_VIEW_ITEM_ICON, getIconHandleAsString( ) ), MAW_RES_OK ); }
/** * The purpose of this test is to test all properties that * you can set on a screen. */ void testImageBackgroundProperty() { TESTIFY_ASSERT_EQUAL( maWidgetSetProperty( getTestWidgetHandle( ), MAW_IMAGE_BUTTON_BACKGROUND_IMAGE, getIconHandleAsString( ) ), MAW_RES_OK ); }
void WidgetTest::testSetProperty(const char *property, const char *value, int expectedReturn) { TESTIFY_ASSERT_EQUAL( maWidgetSetProperty( getTestWidgetHandle( ), property, value ), expectedReturn ); }
/** * The purpose of this test is to test all properties that * you can set on a screen. */ void testImageProperty() { TESTIFY_ASSERT_EQUAL( maWidgetSetProperty( getTestWidgetHandle( ), MAW_IMAGE_IMAGE, getIconHandleAsString( ) ), MAW_RES_OK ); }