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