1e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
2e5c31af7Sopenharmony_ci * drawElements Quality Program Tester Core
3e5c31af7Sopenharmony_ci * ----------------------------------------
4e5c31af7Sopenharmony_ci *
5e5c31af7Sopenharmony_ci * Copyright 2014 The Android Open Source Project
6e5c31af7Sopenharmony_ci *
7e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
8e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License.
9e5c31af7Sopenharmony_ci * You may obtain a copy of the License at
10e5c31af7Sopenharmony_ci *
11e5c31af7Sopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
12e5c31af7Sopenharmony_ci *
13e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
14e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
15e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and
17e5c31af7Sopenharmony_ci * limitations under the License.
18e5c31af7Sopenharmony_ci *
19e5c31af7Sopenharmony_ci *//*!
20e5c31af7Sopenharmony_ci * \file
21e5c31af7Sopenharmony_ci * \brief iOS Application Delegate.
22e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ci#import "tcuIOSAppDelegate.h"
25e5c31af7Sopenharmony_ci#import "tcuEAGLView.h"
26e5c31af7Sopenharmony_ci#import "tcuIOSViewController.h"
27e5c31af7Sopenharmony_ci
28e5c31af7Sopenharmony_ci@implementation tcuIOSAppDelegate
29e5c31af7Sopenharmony_ci
30e5c31af7Sopenharmony_ci@synthesize window = _window;
31e5c31af7Sopenharmony_ci@synthesize viewController = _viewController;
32e5c31af7Sopenharmony_ci
33e5c31af7Sopenharmony_ci- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
34e5c31af7Sopenharmony_ci{
35e5c31af7Sopenharmony_ci	DE_UNREF(application && launchOptions);
36e5c31af7Sopenharmony_ci
37e5c31af7Sopenharmony_ci	// Construct window.
38e5c31af7Sopenharmony_ci	self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
39e5c31af7Sopenharmony_ci	if (!self.window)
40e5c31af7Sopenharmony_ci	{
41e5c31af7Sopenharmony_ci		[self release];
42e5c31af7Sopenharmony_ci		return NO;
43e5c31af7Sopenharmony_ci	}
44e5c31af7Sopenharmony_ci
45e5c31af7Sopenharmony_ci	self.window.backgroundColor = [UIColor whiteColor];
46e5c31af7Sopenharmony_ci
47e5c31af7Sopenharmony_ci	// Create view controller.
48e5c31af7Sopenharmony_ci	self.viewController = [tcuIOSViewController alloc];
49e5c31af7Sopenharmony_ci
50e5c31af7Sopenharmony_ci	[self.window setRootViewController:self.viewController];
51e5c31af7Sopenharmony_ci
52e5c31af7Sopenharmony_ci	[self.window makeKeyAndVisible];
53e5c31af7Sopenharmony_ci	[self.window layoutSubviews];
54e5c31af7Sopenharmony_ci
55e5c31af7Sopenharmony_ci	// Disable idle timer (keep screen on).
56e5c31af7Sopenharmony_ci	[[UIApplication sharedApplication] setIdleTimerDisabled: YES];
57e5c31af7Sopenharmony_ci
58e5c31af7Sopenharmony_ci    return YES;
59e5c31af7Sopenharmony_ci}
60e5c31af7Sopenharmony_ci
61e5c31af7Sopenharmony_ci- (void)applicationWillResignActive:(UIApplication *)application
62e5c31af7Sopenharmony_ci{
63e5c31af7Sopenharmony_ci	DE_UNREF(application);
64e5c31af7Sopenharmony_ci	[self.viewController stopTestIteration];
65e5c31af7Sopenharmony_ci}
66e5c31af7Sopenharmony_ci
67e5c31af7Sopenharmony_ci- (void)applicationDidEnterBackground:(UIApplication *)application
68e5c31af7Sopenharmony_ci{
69e5c31af7Sopenharmony_ci	DE_UNREF(application);
70e5c31af7Sopenharmony_ci}
71e5c31af7Sopenharmony_ci
72e5c31af7Sopenharmony_ci- (void)applicationWillEnterForeground:(UIApplication *)application
73e5c31af7Sopenharmony_ci{
74e5c31af7Sopenharmony_ci	DE_UNREF(application);
75e5c31af7Sopenharmony_ci}
76e5c31af7Sopenharmony_ci
77e5c31af7Sopenharmony_ci- (void)applicationDidBecomeActive:(UIApplication *)application
78e5c31af7Sopenharmony_ci{
79e5c31af7Sopenharmony_ci	DE_UNREF(application);
80e5c31af7Sopenharmony_ci	[self.viewController startTestIteration];
81e5c31af7Sopenharmony_ci}
82e5c31af7Sopenharmony_ci
83e5c31af7Sopenharmony_ci- (void)applicationWillTerminate:(UIApplication *)application
84e5c31af7Sopenharmony_ci{
85e5c31af7Sopenharmony_ci	DE_UNREF(application);
86e5c31af7Sopenharmony_ci	[self.viewController stopTestIteration];
87e5c31af7Sopenharmony_ci}
88e5c31af7Sopenharmony_ci
89e5c31af7Sopenharmony_ci- (void)dealloc
90e5c31af7Sopenharmony_ci{
91e5c31af7Sopenharmony_ci	[_window release];
92e5c31af7Sopenharmony_ci	[_viewController release];
93e5c31af7Sopenharmony_ci    [super dealloc];
94e5c31af7Sopenharmony_ci}
95e5c31af7Sopenharmony_ci
96e5c31af7Sopenharmony_ci@end
97