Exemplo n.º 1
0
} END_TEST

/**
 * \brief Test to create application view.
 *
 * The test create and destroy application view. Check if everything behaves
 * correctly.
 */
START_TEST(test_create_application) {

	ViewGeneric *view = NULL;

	view  = view_create(VIEW_APPLICATION);
	fail_if( NULL == view, NULL );
	fail_if( NULL == view->specific_data, NULL );
	fail_if( NULL != view->model, NULL );
	fail_if( NULL != view->controller, NULL );
	fail_if( VIEW_APPLICATION != view->type, NULL );
	fail_if( 0 != view->last_sequence, NULL );
	fail_if( 1 != view->reference, NULL );

	// check that simple destruction won't work
	fail_if( OK == view_destroy(view), NULL );
	fail_if( ! error_is_error(), NULL );
	error_reset();

	// check that unreference work
	fail_if( OK != view_unref(view), NULL );

} END_TEST
Exemplo n.º 2
0
/** Decrease reference counter for view and if reference count reaches zero,
 * then call destroy function on the view.
 *
 * \param view pointer to generic view structure
 * \return OK on success
 */
RCode view_unref(ViewGeneric *view) {
	ASSERT( NULL != view );

	if ( 0 != (--view->reference) ) {
		return OK;
	}

	return view_destroy(view);
}
Exemplo n.º 3
0
/**
 * @brief This callback function is called once after the main loop of the application exits.
 */
static void app_terminate(void *user_data)
{
	/* Release all resources. */
	view_destroy();
	data_finalize();
}