iut 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. data/.gitignore +9 -0
  2. data/Gemfile +4 -0
  3. data/Rakefile +1 -0
  4. data/bin/iut +2 -0
  5. data/iut.gemspec +24 -0
  6. data/lib/iut.rb +17 -0
  7. data/lib/iut/generator.rb +28 -0
  8. data/lib/iut/version.rb +4 -0
  9. data/template/project/iUnitTest/iUnitTest.xcodeproj/project.pbxproj +480 -0
  10. data/template/project/iUnitTest/iUnitTest/Classes/.do_not_remove_this_directory +0 -0
  11. data/template/project/iUnitTest/iUnitTest/Tests/.do_not_remove_this_directory +0 -0
  12. data/template/project/iUnitTest/iUnitTest/en.lproj/InfoPlist.strings +2 -0
  13. data/template/project/iUnitTest/iUnitTest/iUnitTest-Info.plist +44 -0
  14. data/template/project/iUnitTest/iUnitTest/iUnitTest-Prefix.pch +14 -0
  15. data/template/project/iUnitTest/iUnitTest/iunittest/Default.png +0 -0
  16. data/template/project/iUnitTest/iUnitTest/iunittest/IUTAppDelegate.h +20 -0
  17. data/template/project/iUnitTest/iUnitTest/iunittest/IUTAppDelegate.m +38 -0
  18. data/template/project/iUnitTest/iUnitTest/iunittest/IUTDetailView.xib +184 -0
  19. data/template/project/iUnitTest/iUnitTest/iunittest/IUTMainWindow.xib +732 -0
  20. data/template/project/iUnitTest/iUnitTest/iunittest/IUTTestView.xib +432 -0
  21. data/template/project/iUnitTest/iUnitTest/iunittest/Settings.bundle/Japanese.lproj/Root.strings +0 -0
  22. data/template/project/iUnitTest/iUnitTest/iunittest/Settings.bundle/Root.plist +39 -0
  23. data/template/project/iUnitTest/iUnitTest/iunittest/Settings.bundle/en.lproj/Root.strings +0 -0
  24. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/AppAgent.h +33 -0
  25. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/AppAgent.m +135 -0
  26. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/AppAgentHelper.h +63 -0
  27. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UINavigationBarBasedTest.h +25 -0
  28. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UINavigationBarBasedTest.m +49 -0
  29. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITabBarAndNavigationBarBasedTest.h +23 -0
  30. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITabBarAndNavigationBarBasedTest.m +42 -0
  31. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITabBarBasedTest.h +25 -0
  32. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITabBarBasedTest.m +50 -0
  33. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITableViewBasedTest.h +23 -0
  34. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITableViewBasedTest.m +57 -0
  35. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITableViewControllerTest.h +22 -0
  36. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UITableViewControllerTest.m +44 -0
  37. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UIViewBasedTest.h +21 -0
  38. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UIViewBasedTest.m +52 -0
  39. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UIViewControllerTest.h +63 -0
  40. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/ControllerTest/UIViewControllerTest.m +162 -0
  41. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/GTMSenTestCase.h +17 -0
  42. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/GTMSenTestCase.m +15 -0
  43. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTAssertion.h +135 -0
  44. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTAssertion.m +216 -0
  45. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTAssertionInfo.h +60 -0
  46. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTAssertionInfo.m +104 -0
  47. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTDetailViewController.h +24 -0
  48. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTDetailViewController.m +81 -0
  49. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTLog.h +14 -0
  50. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTPreference.h +34 -0
  51. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTPreference.m +125 -0
  52. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTResultTableViewCell.h +27 -0
  53. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTResultTableViewCell.m +83 -0
  54. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTResultTableViewController.h +26 -0
  55. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTResultTableViewController.m +193 -0
  56. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTest.h +74 -0
  57. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTest.m +127 -0
  58. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTestRunner.h +66 -0
  59. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTestRunner.m +449 -0
  60. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTestRunnerViewController.h +59 -0
  61. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/IUTTestRunnerViewController.m +163 -0
  62. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/NSExceptionExtension.h +21 -0
  63. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/NSExceptionExtension.m +52 -0
  64. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/SenTestAssertion.h +82 -0
  65. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/SourceCodeOpener.h +65 -0
  66. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/SourceCodeOpener.m +176 -0
  67. data/template/project/iUnitTest/iUnitTest/iunittest/UnitTest/UITableViewControllerTestHelper.h +35 -0
  68. data/template/project/iUnitTest/iUnitTest/iunittest/isd_logo_60x40.png +0 -0
  69. data/template/project/iUnitTest/iUnitTest/iunittest/isd_logo_60x40_w.png +0 -0
  70. data/template/project/iUnitTest/iUnitTest/iunittest/iunittest_icon.png +0 -0
  71. data/template/project/iUnitTest/iUnitTest/main.m +18 -0
  72. data/template/project/iUnitTest/script/sync_source.rb +27 -0
  73. metadata +119 -0
@@ -0,0 +1,33 @@
1
+ //
2
+ // AppAgent.h
3
+ // irPanelTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/11/17.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+
11
+
12
+ @interface AppAgent : NSObject {
13
+
14
+ }
15
+
16
+ + (AppAgent *)sharedAppAgent;
17
+
18
+ @property (assign, readonly) UIWindow *window;
19
+ @property (assign, readonly) UINavigationController *navigationController;
20
+
21
+ @property (assign, readonly) UIViewController *visibleViewController;
22
+ @property (assign, readonly) UITableViewController *tableViewController;
23
+
24
+ @property (assign, readonly) UITableView *tableView;
25
+
26
+
27
+ - (UITextField *)textFieldInView:(UIView *)view;
28
+ - (UISwitch *)switchInView:(UIView *)view;
29
+
30
+ - (NSArray *)alertViews;
31
+ - (int)closeAllAlertViews;
32
+
33
+ @end
@@ -0,0 +1,135 @@
1
+ //
2
+ // AppAgent.m
3
+ // irPanelTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/11/17.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import "AppAgent.h"
10
+
11
+
12
+ @implementation AppAgent
13
+
14
+ + (AppAgent *)sharedAppAgent
15
+ {
16
+ static id agent = nil;
17
+ if (agent == nil) {
18
+ agent = [self new];
19
+ }
20
+ return agent;
21
+ }
22
+
23
+
24
+ - (UIWindow *)window
25
+ {
26
+ UIApplication *app = [UIApplication sharedApplication];
27
+ return [app keyWindow];
28
+ }
29
+
30
+
31
+ - (UIView *)findViewWithClass:(Class)klass inViews:(NSArray *)views
32
+ {
33
+ NSEnumerator *viewEnumerator = [views reverseObjectEnumerator];
34
+ UIView *view;
35
+
36
+ while (view = [viewEnumerator nextObject]) {
37
+ if ([view isKindOfClass:klass]) {
38
+ return view;
39
+ }
40
+ }
41
+ viewEnumerator = [views reverseObjectEnumerator];
42
+ while (view = [viewEnumerator nextObject]) {
43
+ UIView *foundView = [self findViewWithClass:klass inViews:[view subviews]];
44
+ if (foundView) {
45
+ return foundView;
46
+ }
47
+ }
48
+ return nil;
49
+ }
50
+
51
+ - (NSArray *)findAllViewWithClass:(Class)klass inViews:(NSArray *)views
52
+ {
53
+ NSMutableArray *result = [NSMutableArray array];
54
+
55
+ NSEnumerator *viewEnumerator = [views reverseObjectEnumerator];
56
+ UIView *view;
57
+
58
+ while (view = [viewEnumerator nextObject]) {
59
+ if ([view isKindOfClass:klass]) {
60
+ [result addObject:view];
61
+ }
62
+ }
63
+ viewEnumerator = [views reverseObjectEnumerator];
64
+ while (view = [viewEnumerator nextObject]) {
65
+ [result addObjectsFromArray:[self findAllViewWithClass:klass inViews:[view subviews]]];
66
+ }
67
+ return result;
68
+ }
69
+
70
+ - (UINavigationBar *)findNavigationBarInViews:(NSArray *)views
71
+ {
72
+ return (UINavigationBar *)[self findViewWithClass:[UINavigationBar class] inViews:views];
73
+ }
74
+
75
+ - (UINavigationController *)navigationController
76
+ {
77
+ UINavigationBar *navigationBar = [self findNavigationBarInViews:[self.window subviews]];
78
+ id delegate = navigationBar.delegate;
79
+ if ([delegate isKindOfClass:[UINavigationController class]]) {
80
+ return delegate;
81
+ }
82
+ return nil;
83
+ }
84
+
85
+ - (UIViewController *)visibleViewController
86
+ {
87
+ return [self.navigationController visibleViewController];
88
+ }
89
+
90
+ - (UITableViewController *)tableViewController
91
+ {
92
+ UIViewController *controller = self.visibleViewController;
93
+ if ([controller isKindOfClass:[UITableViewController class]]) {
94
+ return (UITableViewController *)self.visibleViewController;
95
+ }
96
+ return nil;
97
+ }
98
+
99
+
100
+ - (UITableView *)tableView
101
+ {
102
+ UIViewController *conteroller = self.visibleViewController;
103
+ if ([conteroller isKindOfClass:[UITableViewController class]]) {
104
+ return ((UITableViewController *)conteroller).tableView;
105
+ }
106
+ return nil;
107
+ }
108
+
109
+ - (UITextField *)textFieldInView:(UIView *)view
110
+ {
111
+ return (UITextField *)[self findViewWithClass:[UITextField class] inViews:[view subviews]];
112
+ }
113
+
114
+ - (UISwitch *)switchInView:(UIView *)view
115
+ {
116
+ return (UISwitch *)[self findViewWithClass:[UISwitch class] inViews:[view subviews]];
117
+ }
118
+
119
+
120
+ - (NSArray *)alertViews
121
+ {
122
+ return [self findAllViewWithClass:[UIAlertView class] inViews:[self.window subviews]];
123
+ }
124
+
125
+ - (int)closeAllAlertViews
126
+ {
127
+ NSArray *alertViews = self.alertViews;
128
+
129
+ for (UIAlertView *alertView in alertViews) {
130
+ [alertView dismissWithClickedButtonIndex:0 animated:NO];
131
+ }
132
+ return [alertViews count];
133
+ }
134
+
135
+ @end
@@ -0,0 +1,63 @@
1
+ /*
2
+ * AppAgentHelper.h
3
+ * irPanelTest
4
+ *
5
+ * Created by Katsuyoshi Ito on 09/11/17.
6
+ * Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ *
8
+ */
9
+
10
+ #import "AppAgent.h"
11
+
12
+
13
+
14
+ #pragma mark -
15
+ #pragma mark get object
16
+
17
+ #define AGENT [AppAgent sharedAppAgent]
18
+
19
+ #define TABLEVIEW AGENT.tableView
20
+ #define VIEWCONTROLLER AGENT.visibleViewController
21
+ #define TABLEVIEWCONTROLLER AGENT.tableViewController
22
+
23
+ #define TABLEVIEW_CELL(r,s) [AGENT.tableViewController tableView:AGENT.tableViewController.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:r inSection:s]]
24
+
25
+
26
+ #define TEXTFIELD_IN_VIEW(v) [AGENT textFieldInView:v]
27
+ #define SWITCH_IN_VIEW(v) [AGENT switchInView:v]
28
+
29
+
30
+ #define ALERTVIEWS AGENT.alertViews
31
+
32
+
33
+
34
+ #pragma mark -
35
+ #pragma mark actions
36
+
37
+
38
+ #define _SEND_ACTION(obj) do {\
39
+ UIBarButtonItem *item = obj;\
40
+ [item.target performSelector:item.action withObject:NULL];\
41
+ } while(0)
42
+
43
+
44
+ #define TOUCH_BACK_BAR_BUTTON_ITEM() _SEND_ACTION(AGENT.visibleViewController.navigationItem.backBarButtonItem)
45
+
46
+ #define TOUCH_LEFT_BAR_BUTTON_ITEM() _SEND_ACTION(AGENT.visibleViewController.navigationItem.leftBarButtonItem)
47
+
48
+ #define TOUCH_RIGHT_BAR_BUTTON_ITEM() _SEND_ACTION(AGENT.visibleViewController.navigationItem.rightBarButtonItem)
49
+
50
+
51
+ #define TOUCH_CELL(r,s) do{\
52
+ UITableViewController *controller = TABLEVIEWCONTROLLER;\
53
+ [controller tableView:controller.tableView didSelectRowAtIndexPath:[NSIndexPath indexPathForRow:r inSection:s]];\
54
+ } while(0)
55
+
56
+ #define TOUCH_ACCESSORY_BUTTON_OF_CELL(r,s) do{\
57
+ UITableViewController *controller = TABLEVIEWCONTROLLER;\
58
+ [controller tableView:controller.tableView accessoryButtonTappedForRowWithIndexPath:[NSIndexPath indexPathForRow:r inSection:s]];\
59
+ } while(0)
60
+
61
+ #define CLOSE_ALL_ALERTVIEWS() [AGENT closeAllAlertViews]
62
+
63
+
@@ -0,0 +1,25 @@
1
+ //
2
+ // UINavigationBarBasedTest.h
3
+ // iUnitTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/01/17.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import "IUTTest.h"
11
+
12
+
13
+ @interface UINavigationBarBasedTest : IUTTest {
14
+ UIWindow *window;
15
+ UINavigationController *navigationController;
16
+ }
17
+
18
+ @property (retain, readonly) UIWindow *window;
19
+ @property (retain, readonly) UINavigationController *navigationController;
20
+
21
+
22
+ // Override to return a view controller that is tested.
23
+ @property (assign, readonly) UIViewController *rootViewController;
24
+
25
+ @end
@@ -0,0 +1,49 @@
1
+ //
2
+ // UINavigationBarBasedTest.m
3
+ // iUnitTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/01/17.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import "UINavigationBarBasedTest.h"
10
+
11
+
12
+ @implementation UINavigationBarBasedTest
13
+
14
+ @synthesize window, navigationController;
15
+
16
+ - (void)setUp
17
+ {
18
+ [super setUp];
19
+
20
+ window = [[UIApplication sharedApplication].keyWindow retain];
21
+ navigationController = [[UINavigationController alloc] initWithRootViewController:self.rootViewController];
22
+ [window addSubview:navigationController.view];
23
+ [window bringSubviewToFront:navigationController.view];
24
+ }
25
+
26
+ - (void)tearDown
27
+ {
28
+ [navigationController.view removeFromSuperview];
29
+ [navigationController release];
30
+ navigationController = nil;
31
+ [window release];
32
+ window = nil;
33
+ [super tearDown];
34
+ }
35
+
36
+ - (UIViewController *)rootViewController
37
+ {
38
+ return [[[UITableViewController alloc] initWithStyle:UITableViewStylePlain] autorelease];
39
+ }
40
+
41
+ - (void)dealloc
42
+ {
43
+ [navigationController.view removeFromSuperview];
44
+ [navigationController release];
45
+ [window release];
46
+ [super dealloc];
47
+ }
48
+
49
+ @end
@@ -0,0 +1,23 @@
1
+ //
2
+ // UITabBarAndNavigationBarBasedTest.h
3
+ // iUnitTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/01/17.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import "UITabBarBasedTest.h"
11
+
12
+
13
+ @interface UITabBarAndNavigationBarBasedTest : UITabBarBasedTest {
14
+ UINavigationController *navigationController;
15
+ }
16
+
17
+ @property (retain, readonly) UINavigationController *navigationController;
18
+
19
+
20
+ // Override to return a view controller that is tested.
21
+ @property (assign, readonly) UIViewController *rootViewController;
22
+
23
+ @end
@@ -0,0 +1,42 @@
1
+ //
2
+ // UITabBarAndNavigationBarBasedTest.m
3
+ // iUnitTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/01/17.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import "UITabBarAndNavigationBarBasedTest.h"
10
+
11
+
12
+ @implementation UITabBarAndNavigationBarBasedTest
13
+
14
+ @synthesize navigationController;
15
+
16
+ - (void)tearDown
17
+ {
18
+ [navigationController.view removeFromSuperview];
19
+ [navigationController release];
20
+ navigationController = nil;
21
+ [super tearDown];
22
+ }
23
+
24
+ - (NSArray *)viewControllers
25
+ {
26
+ return [NSArray arrayWithObject:[[[UINavigationController alloc] initWithRootViewController:self.rootViewController] autorelease]];
27
+ }
28
+
29
+
30
+ - (UIViewController *)rootViewController
31
+ {
32
+ return [[[UITableViewController alloc] initWithStyle:UITableViewStylePlain] autorelease];
33
+ }
34
+
35
+ - (void)dealloc
36
+ {
37
+ [navigationController.view removeFromSuperview];
38
+ [navigationController release];
39
+ [super dealloc];
40
+ }
41
+
42
+ @end
@@ -0,0 +1,25 @@
1
+ //
2
+ // UITabBarBasedTest.h
3
+ // iUnitTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/01/17.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import <UIKit/UIKit.h>
10
+ #import "IUTTest.h"
11
+
12
+
13
+ @interface UITabBarBasedTest : IUTTest {
14
+ UIWindow *window;
15
+ UITabBarController *tabBarController;
16
+ }
17
+
18
+ @property (retain, readonly) UIWindow *window;
19
+ @property (retain, readonly) UITabBarController *tabBarController;
20
+
21
+ // Override to return view controllers that is tested.
22
+ /** @TypeInfo UIViewController */
23
+ @property (assign, readonly) NSArray *viewControllers;
24
+
25
+ @end
@@ -0,0 +1,50 @@
1
+ //
2
+ // UITabBarBasedTest.m
3
+ // iUnitTest
4
+ //
5
+ // Created by Katsuyoshi Ito on 09/01/17.
6
+ // Copyright 2009 ITO SOFT DESIGN Inc. All rights reserved.
7
+ //
8
+
9
+ #import "UITabBarBasedTest.h"
10
+
11
+
12
+ @implementation UITabBarBasedTest
13
+
14
+ @synthesize window, tabBarController;
15
+
16
+ - (void)setUp
17
+ {
18
+ [super setUp];
19
+
20
+ window = [[UIApplication sharedApplication].keyWindow retain];
21
+ tabBarController = [UITabBarController new];
22
+ tabBarController.viewControllers = [self viewControllers];
23
+ [window addSubview:tabBarController.view];
24
+ [window bringSubviewToFront:tabBarController.view];
25
+ }
26
+
27
+ - (void)tearDown
28
+ {
29
+ [tabBarController.view removeFromSuperview];
30
+ [tabBarController release];
31
+ tabBarController = nil;
32
+ [window release];
33
+ window = nil;
34
+ [super tearDown];
35
+ }
36
+
37
+ - (NSArray *)viewControllers
38
+ {
39
+ return [NSArray arrayWithObject:[[[UITableViewController alloc] initWithStyle:UITableViewStylePlain] autorelease]];
40
+ }
41
+
42
+ - (void)dealloc
43
+ {
44
+ [tabBarController.view removeFromSuperview];
45
+ [tabBarController release];
46
+ [window release];
47
+ [super dealloc];
48
+ }
49
+
50
+ @end