Skip to content

Commit

Permalink
Add crash method to test app #14682
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Richter committed Apr 20, 2016
1 parent c52d0e0 commit e004cc9
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 6 deletions.
4 changes: 4 additions & 0 deletions test/apps/BoxSim/BoxSim.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
D002A5831CC67A7200380B83 /* TextDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextDisplay.h; sourceTree = "<group>"; };
D0CFE6661CBD6F4E00E18918 /* BoxSim.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BoxSim.app; sourceTree = BUILT_PRODUCTS_DIR; };
D0CFE66A1CBD6F4E00E18918 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
D0CFE66C1CBD6F4E00E18918 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -105,6 +106,7 @@
D0CFE6681CBD6F4E00E18918 /* BoxSim */ = {
isa = PBXGroup;
children = (
D002A5831CC67A7200380B83 /* TextDisplay.h */,
D0CFE66C1CBD6F4E00E18918 /* AppDelegate.h */,
D0CFE66D1CBD6F4E00E18918 /* AppDelegate.m */,
D0CFE66F1CBD6F4E00E18918 /* ViewController.h */,
Expand Down Expand Up @@ -423,6 +425,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
INFOPLIST_FILE = BoxSim/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.preemptive.ppios.test.BoxSim;
Expand All @@ -434,6 +437,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
INFOPLIST_FILE = BoxSim/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.preemptive.ppios.test.BoxSim;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
}
],
"info" : {
Expand Down
6 changes: 3 additions & 3 deletions test/apps/BoxSim/BoxSim/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand All @@ -15,7 +16,6 @@
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
Expand Down
30 changes: 27 additions & 3 deletions test/apps/BoxSim/BoxSim/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,22 +1,46 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6211" systemVersion="14A298i" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6204"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="TQi-6b-9kg">
<rect key="frame" x="20" y="80" width="560" height="512"/>
<subviews>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="IJG-Pj-jNe">
<rect key="frame" x="0.0" y="0.0" width="560" height="512"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
</scrollView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="EaU-5f-HuI">
<rect key="frame" x="63" y="42" width="53" height="30"/>
<state key="normal" title="Just Go"/>
<connections>
<action selector="justGoAction:" destination="BYZ-38-t0r" eventType="touchUpInside" id="wpa-vj-F7V"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<connections>
<outlet property="textView" destination="IJG-Pj-jNe" id="hcM-iI-swu"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
Expand Down
10 changes: 10 additions & 0 deletions test/apps/BoxSim/BoxSim/TextDisplay.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2016 PreEmptive Solutions LLC. All rights reserved.

#ifndef TextDisplay_h
#define TextDisplay_h

@interface TextDisplay : NSObject
- (void)write:(NSString *)text;
@end

#endif // TextDisplay_h
101 changes: 101 additions & 0 deletions test/apps/BoxSim/BoxSim/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,122 @@
//

#import "ViewController.h"
#import "TextDisplay.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextView *textView;
- (void)write:(NSString *)text;
@end

@implementation TextDisplay
- (void)write:(NSString *)text {
}
@end

@interface ViewTextDisplay : TextDisplay {
ViewController * controller;
}
- (void)set:(ViewController *)newValue;
@end

@implementation ViewTextDisplay
- (void)set:(ViewController *)newValue {
controller = newValue;
}

- (void)write:(NSString *)text {
[controller write:text];
}
@end

@interface BSClassP : NSObject
- (void)doSomethingP:(TextDisplay *)textDisplay;
@end

static int countTilCrash = 3;
@implementation BSClassP
- (void)doSomethingP:(TextDisplay *)textDisplay {
[textDisplay write:@"enter:doSomethingP\n"];
if (--countTilCrash <= 0) {
char * x = 0x0;
*x = 6;
}
[textDisplay write:[NSString stringWithFormat:@"count:%d\n", countTilCrash]];
[textDisplay write:@"exit:doSomethingP\n"];
}
@end

@interface BSClassO : NSObject
- (void)doSomethingO:(TextDisplay *)textDisplay;
@end

@implementation BSClassO : NSObject
- (void)doSomethingO:(TextDisplay *)textDisplay {
[textDisplay write:@"enter:doSomethingO\n"];
BSClassP * classP = [BSClassP new];
[classP doSomethingP:textDisplay];
[textDisplay write:@"exit:doSomethingO\n"];
}
@end

@interface BSClassN : NSObject
+ (void)doSomethingInClassN:(TextDisplay *)textDisplay;
@end

@implementation BSClassN
+ (void)doSomethingInClassN:(TextDisplay *)textDisplay {
[textDisplay write:@"enter:doSomethingInClassN\n"];
BSClassO * classO = [BSClassO new];
[classO doSomethingO:textDisplay];
[textDisplay write:@"exit:doSomethingInClassN\n"];
}
@end

@interface BSClassM : NSObject
- (void)doSomethingM:(TextDisplay *)textDisplay;
@end

@implementation BSClassM
- (void)doSomethingM:(TextDisplay *)textDisplay {
[textDisplay write:@"enter:doSomethingM\n"];
[[BSClassN class] doSomethingInClassN:textDisplay];
[textDisplay write:@"exit:doSomethingM\n"];
}
@end

@implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.

self.textView.textColor = [UIColor lightGrayColor];
self.textView.font = [UIFont systemFontOfSize:14];
self.textView.editable = NO;
self.textView.scrollEnabled = YES;

}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self.textView resignFirstResponder];
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}

- (void)write:(NSString *)text {
self.textView.text = [self.textView.text stringByAppendingString:text];
}

- (IBAction)justGoAction:(id)sender {
self.textView.text = @"";
ViewTextDisplay * textDisplay = [ViewTextDisplay new];
[textDisplay set:self];
[textDisplay write:@"enter:justGoAction\n"];
BSClassM * classM = [BSClassM new];
[classM doSomethingM:textDisplay];
[textDisplay write:@"exit:justGoAction\n"];
}
@end

0 comments on commit e004cc9

Please sign in to comment.