Skip to content
Browse files

Moved to the tharpa github clone.

  • Loading branch information...
1 parent ca5a8ec commit 81f06607c2f628ba461147ee3ee94e22f1d20790 @tharpa committed Apr 9, 2013
Showing with 0 additions and 13,256 deletions.
  1. +0 −15 .gitignore
  2. +0 −238 CHANGELOG.md
  3. +0 −58 Classes-MacOSX/GHUnitTestMain.m
  4. +0 −23 Classes-MacOSX/UI/GHTestApp.h
  5. +0 −54 Classes-MacOSX/UI/GHTestApp.m
  6. +0 −143 Classes-MacOSX/UI/GHTestApp.xib
  7. +0 −32 Classes-MacOSX/UI/GHTestOutlineViewModel.h
  8. +0 −155 Classes-MacOSX/UI/GHTestOutlineViewModel.m
  9. +0 −1,957 Classes-MacOSX/UI/GHTestView.xib
  10. +0 −106 Classes-MacOSX/UI/GHTestViewController.h
  11. +0 −430 Classes-MacOSX/UI/GHTestViewController.m
  12. +0 −1,538 Classes-MacOSX/UI/GHTestWindow.xib
  13. +0 −41 Classes-MacOSX/UI/GHTestWindowController.h
  14. +0 −70 Classes-MacOSX/UI/GHTestWindowController.m
  15. +0 −49 Classes-iOS/GHImageDiffView.h
  16. +0 −109 Classes-iOS/GHImageDiffView.m
  17. +0 −41 Classes-iOS/GHUIImageViewControl.h
  18. +0 −68 Classes-iOS/GHUIImageViewControl.m
  19. +0 −42 Classes-iOS/GHUnitIOSAppDelegate.h
  20. +0 −70 Classes-iOS/GHUnitIOSAppDelegate.m
  21. +0 −44 Classes-iOS/GHUnitIOSTableViewDataSource.h
  22. +0 −110 Classes-iOS/GHUnitIOSTableViewDataSource.m
  23. +0 −59 Classes-iOS/GHUnitIOSTestView.h
  24. +0 −143 Classes-iOS/GHUnitIOSTestView.m
  25. +0 −49 Classes-iOS/GHUnitIOSTestViewController.h
  26. +0 −126 Classes-iOS/GHUnitIOSTestViewController.m
  27. +0 −57 Classes-iOS/GHUnitIOSView.h
  28. +0 −94 Classes-iOS/GHUnitIOSView.m
  29. +0 −73 Classes-iOS/GHUnitIOSViewController.h
  30. +0 −311 Classes-iOS/GHUnitIOSViewController.m
  31. +0 −36 Classes-iOS/GHUnitIPhoneAppDelegate.h
  32. +0 −34 Classes-iOS/GHUnitIPhoneAppDelegate.m
  33. +0 −163 Classes/GHAsyncTestCase.h
  34. +0 −179 Classes/GHAsyncTestCase.m
  35. +0 −44 Classes/GHTest/GHTest+JUnitXML.h
  36. +0 −48 Classes/GHTest/GHTest+JUnitXML.m
  37. +0 −272 Classes/GHTest/GHTest.h
  38. +0 −268 Classes/GHTest/GHTest.m
  39. +0 −42 Classes/GHTest/GHTestGroup+JUnitXML.h
  40. +0 −64 Classes/GHTest/GHTestGroup+JUnitXML.m
  41. +0 −186 Classes/GHTest/GHTestGroup.h
  42. +0 −388 Classes/GHTest/GHTestGroup.m
  43. +0 −47 Classes/GHTest/GHTestOperation.h
  44. +0 −58 Classes/GHTest/GHTestOperation.m
  45. +0 −221 Classes/GHTest/GHTestRunner.h
  46. +0 −311 Classes/GHTest/GHTestRunner.m
  47. +0 −118 Classes/GHTest/GHTestSuite.h
  48. +0 −167 Classes/GHTest/GHTestSuite.m
  49. +0 −153 Classes/GHTest/GHTesting.h
  50. +0 −417 Classes/GHTest/GHTesting.m
  51. +0 −97 Classes/GHTest/NSException+GHTestFailureExceptions.h
  52. +0 −278 Classes/GHTest/NSException+GHTestFailureExceptions.m
  53. +0 −71 Classes/GHTest/NSValue+GHValueFormatter.h
  54. +0 −161 Classes/GHTest/NSValue+GHValueFormatter.m
  55. +0 −161 Classes/GHTestCase.h
  56. +0 −67 Classes/GHTestCase.m
  57. +0 −1,049 Classes/GHTestMacros.h
  58. +0 −51 Classes/GHTestUtils.h
  59. +0 −58 Classes/GHTestUtils.m
  60. +0 −57 Classes/GHUnit.h
  61. +0 −136 Classes/GHViewTestCase.h
  62. +0 −298 Classes/GHViewTestCase.m
  63. +0 −46 Classes/Mock/GHMockNSHTTPURLResponse.h
  64. +0 −62 Classes/Mock/GHMockNSHTTPURLResponse.m
  65. +0 −167 Classes/Mock/GHMockNSURLConnection.h
  66. +0 −146 Classes/Mock/GHMockNSURLConnection.m
  67. +0 −218 Classes/SharedUI/GHTestViewModel.h
  68. +0 −406 Classes/SharedUI/GHTestViewModel.m
  69. +0 −30 Documentation/appledoc_include/guide_ci-template.markdown
  70. +0 −67 Documentation/appledoc_include/guide_command_line-template.markdown
  71. +0 −51 Documentation/appledoc_include/guide_install_ios_4-template.markdown
  72. +0 −15 Documentation/appledoc_include/guide_install_macosx_4-template.markdown
  73. +0 −43 Documentation/appledoc_include/guide_install_old-template.markdown
Sorry, we could not display the entire diff because it was too big.
View
15 .gitignore
@@ -1,15 +0,0 @@
-build
-*.mode1v3
-*.mode2v3
-*.pbxuser
-*.perspectivev3
-.DS_Store
-Documentation/output
-*.tm_build_errors
-*.swp
-*~.nib
-.gitattributes
-GHUnit.docset
-*.xcuserdatad
-Project-iOS/GHUnitIOS.xcodeproj/xcuserdata
-Project-iOS/GHUnitIOS.xcodeproj/project.xcworkspace/xcuserdata
View
238 CHANGELOG.md
@@ -1,238 +0,0 @@
-# Release 0.4.29
-- Changing paths to use iOS instead of iPhone
-- Rebuilding iOS project using XCode 4
-
-# Release 0.4.28
-- Building as GHUnitIOS.framework for iOS.
-- Fix issue #37
-- Fix issue #38
-- Fix issue #39
-- Fix issue #36
-- Fix issue #19
-
-# Release 0.4.27
-- Added in GHUnitIOSAppDelegate for subclassing test app delegate
-
-# Release 0.4.26
-- Fixing LLVM/clang warnings (Whitney Young, nolanw)
-- GHAssertNotEqualStrings will allow for nils (Rusty Zarse)
-- Build warnings under 10.6 (MacOSX); (zykloid)
-- Better error handling on JUnit XML results writing (zykloid)
-- GHAsyncTestCase#runForInterval (Adapted from Robert Palmer, pauseForTimeout)
-
-# Release 0.4.25
-- Set DEPLOYMENT_POSTPROCESSING (MacOSX); So breakpointing doesn't warn about missing symbols
-
-# Release 0.4.24
-- Moved build settings into xcconfig (MacOSX)
-- Striping linked build
-
-# Release 0.4.21
-- Moved build settings into xcconfig (iPhone)
-- Flexible layouts; Works in iPad as universal app
-
-# Release 0.4.20
-- Fix armv6/armv7 device build setting
-
-# Release 0.4.19
-- Fix autorun env on iPhone
-- Added re-run test (experimental!)
-- Test log viewer (iPhone)
-- Showing time in tests vs time running
-
-# Release 0.4.18
-- Fixing test stats on parallel running
-- Adding reraiseException options (MacOSX)
-- Adding env var support for reraise and autorun (see README)
-- Smaller font size for test view (iPhone)
-- Show filename/line number in trace on failure
-- Show link to exception filename on failure (MacOSX)
-- Fix bug where test trace/log doesn't update if selected before running
-
-# Release 0.4.17
-- Fixing disabled on new test bug
-- Fixing bugs with All/Failed/Edit views not showing tests properly (MacOSX)
-
-# Release 0.4.16
-- Fixing hidden tests bug
-
-# Release 0.4.15
-- Text filter (MacOSX)
-- Text filter now searches test case and test names (prefix)
-- Failed filter (MacOSX/iPhone)
-- Copy text in text view (MacOSX)
-- Remember test state
-
-# Release 0.4.14
-- Fix window resizing when showing details
-- Adding test for 0 found test cases
-
-# Release 0.4.13
-- Fixing framework build: Header error and 32/64 bit universal (MacOSX)
-- Fixing SenTest macros not failing correctly
-- Fixing persist of test enabled/disabled state
-- Fixing SenTest macros
-
-# Release 0.4.12
-- Fixing compile warning in main (iPhone)
-
-# Release 0.4.11
-- Added value formatter (from http://github.com/JohannesRudolph); For better Assert error messages.
-- Fixed deprecation warning (iPhone)
-- Added default exception handler to give stack trace if triggered outside of GHUnit run
-
-# Release 0.4.10
-- Added Search Bar
-- Added GHTestSuite#suiteWithPrefix:options
-
-# Release 0.4.9
-- Fix compile warning
-
-# Release 0.4.8
-- Fix bug with turning Parallel off not working
-- Building 32/64 bit universal
-
-# Release 0.4.7
-- Removing redirect, was a bad idea; Test output goes to stderr, you can redirect stdout yourself
-
-# Release 0.4.6
-- Redirecting test output to file
-- Test output does OK/FAIL
-- Disabled tests appear gray (MacOSX)
-- UI fixes
-
-# Release 0.4.5 (2008-07-21)
-- Including GHUnitIOSAppDelegate so you can subclass and interact with UIApplication delegate in tests
-
-# Release 0.4.4 (2008-07-20)
-- Ignore disable/cancelled tests in scroll (iPhone)
-- Only start group test (notify) if we have tests to run
-
-# Release 0.4.3 (2008-07-20)
-- When running test on main thread should wait until finished
-- Auto scrolls to middle instead of bottom (iPhone)
-
-# Release 0.4.2 (2008-07-19)
-- Fixing run warning
-
-# Release 0.4.1 (2008-07-18)
-- Option to use NSOperationQueue to manage tests runs
-- Updated how test groups run
-- Handling failure in setUpClass/tearDownClass
-- Updated how shouldRunOnMainThread works
-- Added Edit UI for Mac OSX tests
-- Bug fixes and other refactoring
-
-# Release 0.3.19 (2008-06-15)
-- Fixed bug in Edit->Save crash (iPhone)
-- Tweaking test text color (iPhone)
-- Re-run crash
-- Added reset to GHTest protocol
-- Added testDidUpdate: to GHTestDelegate protocol
-- On Edit->Save, triggers reset
-- Added cancel to GHTest protocol
-- Added cancelling, cancelled enums to test status
-- Changed testDidFinish to testDidEnd (since test may be cancelled)
-
-# Release 0.3.18 (2008-06-15)
-- Adding Run button; By default tests do not automatically run on start
-- Added AutoRun setting
-
-# Release 0.3.17 (2008-06-09)
-- Updating RunTests.sh
-
-# Release 0.3.16 (2008-06-09)
-- Rebuilding from 3.0 GM
-- Setting debug variables in main directly instead of from setenv (which doesn't seem to work)
-
-# Release 0.3.14 (2008-06-08)
-- Creating separate iPhone 3.0 builds
-
-# Release 0.3.12 (2008-05-25)
-- Creating iPhone static library with device and simulator platforms
-
-# Release 0.3.11 (2008-05-20)
-- Fixing version number
-- Creating separate version with CoreLocation linked
-
-# Release 0.3.10 (2008-05-20)
-- Fix namespace issue
-
-# Release 0.3.9 (2008-05-19)
-
-## 2008-05-19
-- 3.0 compatibility fixes
-- Added GHUITestCase
-- Added shouldRunOnMainThread to test case, and if present and YES will run the tests on the main thread
-
-## 2008-05-05
-- (iPhone) Added select/deselect to iPhone test UI
-- (iPhone) Fixed auto-scroll if you manually scroll (will stop auto-scrolling)
-
-# Release 0.3.8 (2008-04-28)
-
-## 2008-04-28
-- Removed button enabled cell from Mac OS X view; Makes NSOutlineView really slow; Need to figure out how to do it right
-
-# Release 0.3.7 (2008-04-26)
-
-## 2008-04-20
-- CLLocationManager mock
-- Fixed afterDelay not using delay value
-- Select/unselect (ignore) tests in Mac OSX view
-- Added initWithTestSuite to GHTestApp for custom suites from test main
-
-## 2008-04-16
-- Adding ability to set run loops in async test case
-- Adding more methods to NSURLConnection mock
-
-# Release 0.3.6 (2008-04-13)
-
-## 2008-04-13
-- Adding swizzle methods for mocking
-- Adding NSLocale mock
-- Adding NSURLConnection, NSHTTPURLResponse mocks
-- Fix bug with setUpClass/tearDownClass not working for single command line tests
-- Setting Installation Directory to @rpath (Thanks chapados), so you can embed the framework with your app
-- Sorting tests by class name (as well as method name)
-
-# Release 0.3.4 (2009-04-11)
-
-## 2008-04-11
-- Added Doxygen support
-
-## 2008-04-08
-- Added GHAsyncTestCase for asynchronous tests (seems really complex :/, might have gone mental on it)
-- Supporting streaming logging with GHTestLog(...)
-- GHUNIT_VERSION from xcconfig in Info plists and shown in test GUI
-- Mocks for NSURLConnection and NSHTTPURLResponse
-- Added setUpClass/tearDownClass for GHTestCase
-- Added currentSelector property for GHTestCase
-
-# Release 0.3.3 (2009-04-08)
-
-## 2009-04-08
-- Removed GTMLogger and GHLogger; Not used in Release and potentially can
- conflict with project logging with iPhone static library
-
-# Release 0.3.2 (2009-04-05)
-
-## 2009-04-05
-- Building as static library for iPhone
-- Adding in support for running single test case or test
-
-# Release 0.3.1
-
-## 2009-03-22
-- Renamed TEST_CLI to GHUNIT_CLI
-- Removing main from target; Projects should specify their own test target main.
-- Added test for special registered test case classes
-
-## 2009-03-21
-- Renamed Examples/MyTestable to MyTestable-IPhone
-
-## 2009-03-19
-- Commented a bunch of the code
-- Renamed GHTestUtils to GHTesting
-
-
View
58 Classes-MacOSX/GHUnitTestMain.m
@@ -1,58 +0,0 @@
-//
-// GHUnitTestMain.m
-// GHUnit
-//
-// Created by Gabriel Handford on 2/22/09.
-// Copyright 2009. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import <Foundation/Foundation.h>
-
-#import <GHUnit/GHUnit.h>
-#import <GHUnit/GHTestApp.h>
-
-int main(int argc, char *argv[]) {
- @autoreleasepool {
-
- // Register any special test case classes
- //[[GHTesting sharedInstance] registerClassName:@"GHSpecialTestCase"];
-
- int retVal = 0;
- // If GHUNIT_CLI is set we are using the command line interface and run the tests
- // Otherwise load the GUI app
- if (getenv("GHUNIT_CLI")) {
- retVal = [GHTestRunner run];
- } else {
- // To run all tests (from ENV)
- [[GHTestApp alloc] init];
- // To run a different test suite:
- //GHTestSuite *suite = [GHTestSuite suiteWithTestFilter:@"GHSlowTest,GHAsyncTestCaseTest"];
- //GHTestApp *app = [[GHTestApp alloc] initWithSuite:suite];
- // Or set global:
- //GHUnitTest = @"GHSlowTest";
- [NSApp run];
- }
- return retVal;
- }
-}
View
23 Classes-MacOSX/UI/GHTestApp.h
@@ -1,23 +0,0 @@
-//
-// GHTestApp.h
-// GHUnit
-//
-// Created by Gabriel Handford on 1/20/09.
-// Copyright 2009. All rights reserved.
-//
-
-#import "GHTestWindowController.h"
-
-@interface GHTestApp : NSObject {
- NSMutableArray *topLevelObjects_;
-
- GHTestWindowController *windowController_;
-
- GHTestSuite *suite_;
-}
-
-- (id)initWithSuite:(GHTestSuite *)suite;
-
-- (void)runTests;
-
-@end
View
54 Classes-MacOSX/UI/GHTestApp.m
@@ -1,54 +0,0 @@
-//
-// GHTestApp.m
-// GHUnit
-//
-// Created by Gabriel Handford on 1/20/09.
-// Copyright 2009. All rights reserved.
-//
-
-#import "GHTestApp.h"
-
-@implementation GHTestApp
-
-- (id)init {
- if ((self = [super init])) {
- windowController_ = [[GHTestWindowController alloc] init];
- NSBundle *bundle = [NSBundle bundleForClass:[self class]];
- topLevelObjects_ = [[NSMutableArray alloc] init];
- NSDictionary *externalNameTable = [NSDictionary dictionaryWithObjectsAndKeys:self, @"NSOwner", topLevelObjects_, @"NSTopLevelObjects", nil];
- [bundle loadNibFile:@"GHTestApp" externalNameTable:externalNameTable withZone:nil];
- }
- return self;
-}
-
-- (id)initWithSuite:(GHTestSuite *)suite {
- // Since init loads XIB we need to set suite early; For backwards compat.
- suite_ = suite;
- if ((self = [self init])) { }
- return self;
-}
-
-- (void)awakeFromNib {
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:)
- name:NSApplicationWillTerminateNotification object:nil];
- windowController_.viewController.suite = suite_;
- [windowController_ showWindow:nil];
-}
-
-- (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-}
-
-- (void)runTests {
- [windowController_.viewController runTests];
-}
-
-
-#pragma mark Notifications (NSApplication)
-
-- (void)applicationWillTerminate:(NSNotification *)aNotification {
- [windowController_.viewController saveDefaults];
- [[NSUserDefaults standardUserDefaults] synchronize];
-}
-
-@end
View
143 Classes-MacOSX/UI/GHTestApp.xib
@@ -1,143 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
- <data>
- <int key="IBDocument.SystemTarget">1050</int>
- <string key="IBDocument.SystemVersion">9G55</string>
- <string key="IBDocument.InterfaceBuilderVersion">677</string>
- <string key="IBDocument.AppKitVersion">949.43</string>
- <string key="IBDocument.HIToolboxVersion">353.00</string>
- <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSArray" key="IBDocument.PluginDependencies">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilderKit</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.Metadata">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSCustomObject" id="1021">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSCustomObject" id="1014">
- <string key="NSClassName">FirstResponder</string>
- </object>
- <object class="NSCustomObject" id="1050">
- <string key="NSClassName">NSApplication</string>
- </object>
- <object class="NSCustomObject" id="203559887">
- <string key="NSClassName">NSFontManager</string>
- </object>
- </object>
- <object class="IBObjectContainer" key="IBDocument.Objects">
- <object class="NSMutableArray" key="connectionRecords">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="IBMutableOrderedSet" key="objectRecords">
- <object class="NSArray" key="orderedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBObjectRecord">
- <int key="objectID">0</int>
- <object class="NSArray" key="object" id="1049">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <reference key="children" ref="1048"/>
- <nil key="parent"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-2</int>
- <reference key="object" ref="1021"/>
- <reference key="parent" ref="1049"/>
- <string type="base64-UTF8" key="objectName">RmlsZSdzIE93bmVyA</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-1</int>
- <reference key="object" ref="1014"/>
- <reference key="parent" ref="1049"/>
- <string key="objectName">First Responder</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">-3</int>
- <reference key="object" ref="1050"/>
- <reference key="parent" ref="1049"/>
- <string key="objectName">Application</string>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">373</int>
- <reference key="object" ref="203559887"/>
- <reference key="parent" ref="1049"/>
- </object>
- </object>
- </object>
- <object class="NSMutableDictionary" key="flattenedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSMutableArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>-1.IBPluginDependency</string>
- <string>-2.IBPluginDependency</string>
- <string>-3.IBPluginDependency</string>
- <string>373.IBPluginDependency</string>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilderKit</string>
- <string>com.apple.InterfaceBuilderKit</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- </object>
- </object>
- <object class="NSMutableDictionary" key="unlocalizedProperties">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="activeLocalization"/>
- <object class="NSMutableDictionary" key="localizations">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="dict.sortedKeys">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- <object class="NSMutableArray" key="dict.values">
- <bool key="EncodedWithXMLCoder">YES</bool>
- </object>
- </object>
- <nil key="sourceID"/>
- <int key="maxID">494</int>
- </object>
- <object class="IBClassDescriber" key="IBDocument.Classes">
- <object class="NSMutableArray" key="referencedPartialClassDescriptions">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">../Classes/Mock/GHUNSObject+Swizzle.h</string>
- </object>
- </object>
- <object class="IBPartialClassDescription">
- <string key="className">NSObject</string>
- <object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBProjectSource</string>
- <string key="minorKey">../Libraries/GHKit/GHNSObject+Invocation.h</string>
- </object>
- </object>
- </object>
- </object>
- <int key="IBDocument.localizationMode">0</int>
- <string key="IBDocument.LastKnownRelativeProjectPath">../../Project/GHUnit.xcodeproj</string>
- <int key="IBDocument.defaultPropertyAccessControl">3</int>
- </data>
-</archive>
View
32 Classes-MacOSX/UI/GHTestOutlineViewModel.h
@@ -1,32 +0,0 @@
-//
-// GHTestOutlineViewModel.h
-// GHUnit
-//
-// Created by Gabriel Handford on 7/17/09.
-// Copyright 2009. All rights reserved.
-//
-
-#import <Cocoa/Cocoa.h>
-#import "GHTestViewModel.h"
-@class GHTestOutlineViewModel;
-
-#define MIN_WINDOW_WIDTH (635.0)
-
-@protocol GHTestOutlineViewModelDelegate <NSObject>
-- (void)testOutlineViewModelDidChangeSelection:(GHTestOutlineViewModel *)testOutlineViewModel;
-@end
-
-
-
-@interface GHTestOutlineViewModel : GHTestViewModel
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 // on lines like this to not confuse IB
- <NSOutlineViewDelegate, NSOutlineViewDataSource>
-#endif
-{
- __unsafe_unretained id<GHTestOutlineViewModelDelegate> delegate_;
- NSButtonCell *editCell_;
-}
-
-@property (unsafe_unretained, nonatomic) id<GHTestOutlineViewModelDelegate> delegate;
-
-@end
View
155 Classes-MacOSX/UI/GHTestOutlineViewModel.m
@@ -1,155 +0,0 @@
-//
-// GHTestOutlineViewModel.m
-// GHUnit
-//
-// Created by Gabriel Handford on 7/17/09.
-// Copyright 2009. All rights reserved.
-//
-
-#import "GHTestOutlineViewModel.h"
-
-@implementation GHTestOutlineViewModel
-
-@synthesize delegate;
-
-#pragma mark DataSource (NSOutlineView)
-
-- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item {
- if (!item) {
- return [self root];
- } else {
- return [[item children] objectAtIndex:index];
- }
-}
-
-- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item {
- return (!item) ? YES : ([[item children] count] > 0);
-}
-
-- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item {
- return (!item) ? (self ? 1 : 0) : [[item children] count];
-}
-
-- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item {
- if (!item) return nil;
-
- if (tableColumn == nil) {
- return [item nameWithStatus];
- } else if ([[tableColumn identifier] isEqual:@"status"] && ![item hasChildren]) {
- return [item statusString];
- }
- return nil;
-}
-
-- (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item {
- if (self.isEditing) {
- if ([[tableColumn identifier] isEqual:@"name"]) {
- [item setSelected:[object boolValue]];
- [outlineView reloadData];
- }
- }
-}
-
-- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item {
-
- GHTestNode *test = (GHTestNode *)item;
-
- if ([[tableColumn identifier] isEqual:@"name"]) {
-
- NSColor *textColor = [NSColor blackColor];
- if ([test isHidden] || [test isDisabled]) {
- textColor = [NSColor grayColor];
- }
-
- if (self.isEditing) {
- [cell setState:[item isSelected] ? NSOnState : NSOffState];
- NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:
- textColor, NSForegroundColorAttributeName,
- [cell font], NSFontAttributeName,
- nil];
-
- NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:[item name] attributes:attributes];
- [cell setAttributedTitle:attributedString];
- } else {
- [cell setTitle:[item name]];
- [cell setTextColor:textColor];
- }
- }
-
- if ([[tableColumn identifier] isEqual:@"status"]) {
- [cell setTextColor:[NSColor lightGrayColor]];
-
- if ([test status] == GHTestStatusErrored) {
- [cell setTextColor:[NSColor redColor]];
- } else if ([test status] == GHTestStatusSucceeded) {
- [cell setTextColor:[NSColor greenColor]];
- } else if ([test status] == GHTestStatusRunning) {
- [cell setTextColor:[NSColor blackColor]];
- }
- }
-}
-
-// We can return a different cell for each row, if we want
-- (NSCell *)outlineView:(NSOutlineView *)outlineView dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item {
- // If we return a cell for the 'nil' tableColumn, it will be used as a "full width" cell and span all the columns
-// if (tableColumn == nil && [item hasChildren]) {
-// // We want to use the cell for the name column, but we could construct a new cell if we wanted to, or return a different cell for each row.
-// return [[outlineView tableColumnWithIdentifier:@"name"] dataCell];
-// }
-
- if ([[tableColumn identifier] isEqual:@"name"] && self.isEditing) {
- // TODO(gabe): Doesn't work if you try to re-use cells so making a new one;
- // Need help with this; This might explode if you have a lot of tests
- NSButtonCell *cell = [[NSButtonCell alloc] init];
- [cell setControlSize:NSSmallControlSize];
- [cell setFont:[NSFont fontWithName:@"Lucida Grande" size:11]];
- [cell setButtonType:NSSwitchButton];
- [cell setTitle:[item name]];
- [cell setEditable:YES];
- return cell;
- }
-
- return [tableColumn dataCell];
-}
-
-#pragma mark Delegates (NSOutlineView)
-
-- (void)outlineViewSelectionDidChange:(NSNotification *)notification {
- [self.delegate testOutlineViewModelDidChangeSelection:self];
-}
-
-- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item {
- NSInteger clickedCol = [outlineView clickedColumn];
- NSInteger clickedRow = [outlineView clickedRow];
- if (clickedRow >= 0 && clickedCol >= 0) {
- NSCell *cell = [outlineView preparedCellAtColumn:clickedCol row:clickedRow];
- if ([cell isKindOfClass:[NSButtonCell class]] && [cell isEnabled]) {
- return NO;
- }
- }
-
- return (![item hasChildren]);
-}
-
-- (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item {
- return ([item hasChildren]);
-}
-
-- (BOOL)outlineView:(NSOutlineView *)outlineView shouldTrackCell:(NSCell *)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item {
- // We want to allow tracking for all the button cells, even if we don't allow selecting that particular row.
- if ([cell isKindOfClass:[NSButtonCell class]]) {
- // We can also take a peek and make sure that the part of the cell clicked is an area that is normally tracked. Otherwise, clicking outside of the checkbox may make it check the checkbox
- NSRect cellFrame = [outlineView frameOfCellAtColumn:[[outlineView tableColumns] indexOfObject:tableColumn] row:[outlineView rowForItem:item]];
- NSUInteger hitTestResult = [cell hitTestForEvent:[NSApp currentEvent] inRect:cellFrame ofView:outlineView];
- if (hitTestResult && NSCellHitTrackableArea != 0) {
- return YES;
- } else {
- return NO;
- }
- } else {
- // Only allow tracking on selected rows. This is what NSTableView does by default.
- return [outlineView isRowSelected:[outlineView rowForItem:item]];
- }
-}
-
-@end
View
1,957 Classes-MacOSX/UI/GHTestView.xib
0 additions, 1,957 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
106 Classes-MacOSX/UI/GHTestViewController.h
@@ -1,106 +0,0 @@
-//
-// GHTestViewController.h
-// GHKit
-//
-// Created by Gabriel Handford on 1/17/09.
-// Copyright 2009. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import "GHTestViewModel.h"
-#import "GHTestGroup.h"
-#import "GHTestOutlineViewModel.h"
-
-
-@interface GHTestViewController : NSViewController <GHTestRunnerDelegate, GHTestOutlineViewModelDelegate, NSSplitViewDelegate> {
-
- IBOutlet NSSplitView *_splitView;
- IBOutlet NSView *_statusView;
- IBOutlet NSView *_detailsView;
- IBOutlet NSOutlineView *_outlineView;
- IBOutlet NSTextView *_textView;
- IBOutlet NSSegmentedControl *_textSegmentedControl;
- IBOutlet NSSegmentedControl *_segmentedControl;
- IBOutlet NSSearchField *_searchField;
- IBOutlet NSButton *_detailsToggleButton;
-
- BOOL wrapInTextView_;
- NSString *status_;
- double statusProgress_;
- BOOL runInParallel_;
- NSString *runLabel_;
-
- NSString *exceptionFilename_;
- NSInteger exceptionLineNumber_;
-
- GHTestSuite *suite_;
-
- GHTestOutlineViewModel *dataSource_;
- BOOL running_;
-}
-
-@property (assign, nonatomic) BOOL wrapInTextView;
-@property (readonly, nonatomic) id<GHTest> selectedTest;
-@property (readonly, nonatomic) GHTestOutlineViewModel *dataSource;
-
-@property (strong, nonatomic) NSString *status;
-@property (assign, nonatomic) double statusProgress;
-@property (strong, nonatomic) NSString *runLabel;
-
-@property (strong, nonatomic) GHTestSuite *suite;
-@property (assign, nonatomic, getter=isRunning) BOOL running;
-
-@property (strong, nonatomic) NSString *exceptionFilename;
-@property (assign, nonatomic) NSInteger exceptionLineNumber;
-
-@property (assign, nonatomic) BOOL reraiseExceptions;
-@property (assign, nonatomic) BOOL runInParallel;
-
-
-- (void)loadTestSuite;
-
-- (void)selectFirstFailure;
-
-- (IBAction)copy:(id)sender;
-- (IBAction)runTests:(id)sender;
-- (IBAction)toggleDetails:(id)sender;
-- (IBAction)updateTextSegment:(id)sender;
-- (IBAction)updateMode:(id)sender;
-- (IBAction)updateSearchFilter:(id)sender;
-- (IBAction)openExceptionFilename:(id)sender;
-- (IBAction)rerunTest:(id)sender;
-
-- (id<GHTest>)selectedTest;
-
-- (void)runTests;
-
-- (void)reload;
-
-- (void)loadDefaults;
-- (void)saveDefaults;
-
-- (BOOL)isShowingDetails;
-
-- (void)selectRow:(NSInteger)row;
-
-@end
View
430 Classes-MacOSX/UI/GHTestViewController.m
@@ -1,430 +0,0 @@
-//
-// GHTestViewController.m
-// GHKit
-//
-// Created by Gabriel Handford on 1/17/09.
-// Copyright 2009. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import "GHTestViewController.h"
-
-#import "GHTesting.h"
-
-@interface GHTestViewController ()
-- (void)_updateTest:(id<GHTest>)test;
-- (NSString *)_prefix;
-- (void)_setPrefix:(NSString *)prefix;
-- (void)_updateDetailForTest:(id<GHTest>)test prefix:(NSString *)prefix;
-@end
-
-@implementation GHTestViewController
-
-@synthesize suite=suite_, status=status_, statusProgress=statusProgress_,
-wrapInTextView=wrapInTextView_, runLabel=runLabel_, dataSource=dataSource_,
-running=running_, exceptionFilename=exceptionFilename_, exceptionLineNumber=exceptionLineNumber_;
-
-- (id)init {
- if ((self = [super initWithNibName:@"GHTestView" bundle:[NSBundle bundleForClass:[GHTestViewController class]]])) {
- suite_ = [GHTestSuite suiteFromEnv];
-
- NSString *identifier = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"];
- if (!identifier) identifier = @"Tests";
- GHUDebug(@"Using identifier: %@", identifier);
-
- dataSource_ = [[GHTestOutlineViewModel alloc] initWithIdentifier:identifier suite:suite_];
- dataSource_.delegate = self;
- [dataSource_ loadDefaults];
- [self view]; // Force nib awaken
- }
- return self;
-}
-
-- (void)dealloc {
- dataSource_.delegate = nil;
-}
-
-- (void)awakeFromNib {
- _outlineView.delegate = dataSource_;
- _outlineView.dataSource = dataSource_;
-
- // If we remove from superview, need to keep it retained
-
- [_textView setTextColor:[NSColor whiteColor]];
- [_textView setFont:[NSFont fontWithName:@"Monaco" size:10.0]];
- [_textView setString:@""];
- _textSegmentedControl.selectedSegment = [[NSUserDefaults standardUserDefaults] integerForKey:@"TextSelectedSegment"];
-
- _splitView.delegate = self;
-
- NSString *prefix = [self _prefix];
- if (prefix) {
- [_searchField setStringValue:prefix];
- [self updateSearchFilter:nil];
- }
-
- self.wrapInTextView = NO;
- self.runLabel = @"Run";
-}
-
-- (NSString *)_prefix {
- return [[NSUserDefaults standardUserDefaults] objectForKey:@"Prefix"];
-}
-
-- (void)_setPrefix:(NSString *)prefix {
- [[NSUserDefaults standardUserDefaults] setObject:prefix forKey:@"Prefix"];
- [[NSUserDefaults standardUserDefaults] synchronize];
-}
-
-#pragma mark Running
-
-- (IBAction)runTests:(id)sender {
- [self runTests];
-}
-
-- (void)runTests {
- if (dataSource_.isRunning) {
- self.status = @"Cancelling...";
- [dataSource_ cancel];
- } else {
- NSAssert(suite_, @"Must set test suite");
- [self loadTestSuite];
- self.status = @"Starting tests...";
- self.runLabel = @"Cancel";
- BOOL inParallel = self.runInParallel;
- BOOL reraiseExceptions = self.reraiseExceptions;
- // TODO(gabe): This is confusing; Choosing reraise over in parallel since can't have both
- if (inParallel && reraiseExceptions) inParallel = NO;
- GHTestOptions options = 0;
- if (self.reraiseExceptions) options |= GHTestOptionReraiseExceptions;
- [dataSource_ run:self inParallel:inParallel options:options];
- }
-}
-
-- (void)loadTestSuite {
- self.status = @"Loading tests...";
- [self reload];
- self.status = @"Select 'Run' to start tests";
-}
-
-- (void)reload {
- [_outlineView reloadData];
- [_outlineView reloadItem:nil reloadChildren:YES];
- [_outlineView expandItem:nil expandChildren:YES];
-}
-
-#pragma mark -
-
-- (void)setWrapInTextView:(BOOL)wrapInTextView {
- wrapInTextView_ = wrapInTextView;
- if (wrapInTextView_) {
- // No horizontal scroll, word wrapping
- [[_textView enclosingScrollView] setHasHorizontalScroller:NO];
- [_textView setHorizontallyResizable:NO];
- NSSize size = [[_textView enclosingScrollView] frame].size;
- [[_textView textContainer] setContainerSize:NSMakeSize(size.width, FLT_MAX)];
- [[_textView textContainer] setWidthTracksTextView:YES];
- NSRect frame = [_textView frame];
- frame.size.width = size.width;
- [_textView setFrame:frame];
- } else {
- // So we have horizontal scroll
- [[_textView enclosingScrollView] setHasHorizontalScroller:YES];
- [_textView setHorizontallyResizable:YES];
- [[_textView textContainer] setContainerSize:NSMakeSize(FLT_MAX, FLT_MAX)];
- [[_textView textContainer] setWidthTracksTextView:NO];
- }
- [_textView setNeedsDisplay:YES];
-}
-
-- (IBAction)updateMode:(id)sender {
- GHUDebug(@"Update mode: %d", _segmentedControl.selectedSegment);
- switch(_segmentedControl.selectedSegment) {
- case 0: {
- dataSource_.editing = NO;
- [dataSource_.root setFilter:GHTestNodeFilterNone];
- break;
- }
- case 1: {
- dataSource_.editing = NO;
- [dataSource_.root setFilter:GHTestNodeFilterFailed];
- break;
- }
- case 2: {
- dataSource_.editing = YES;
- [dataSource_.root setFilter:GHTestNodeFilterNone];
- break;
- }
- }
- [dataSource_ saveDefaults];
- [self reload];
-}
-
-- (IBAction)updateSearchFilter:(id)sender {
- NSString *prefix = [_searchField stringValue];
- [dataSource_.root setTextFilter:prefix];
- [self _setPrefix:prefix];
- [self reload];
-}
-
-- (IBAction)copy:(id)sender {
- [_textView copy:sender];
-}
-
-- (IBAction)openExceptionFilename:(id)sender {
- if (self.exceptionFilename) {
- NSString *path = [self.exceptionFilename stringByExpandingTildeInPath];
- [[NSWorkspace sharedWorkspace] openFile:path];
- }
-}
-
-- (IBAction)rerunTest:(id)sender {
- id<GHTest> test = [[self selectedTest] copyWithZone:NULL];
- GHUDebug(@"Re-running: %@", test);
- [self _updateDetailForTest:nil prefix:@"Re-running test."];
- [test run:GHTestOptionForceSetUpTearDownClass];
- [self _updateDetailForTest:test prefix:@"Re-ran test. (This feature is experimental.)"];
-}
-
-- (BOOL)isShowingDetails {
- return ![[NSUserDefaults standardUserDefaults] boolForKey:@"ViewCollapsed"];
-}
-
-- (void)setShowingDetails:(BOOL)showingDetails {
- [[NSUserDefaults standardUserDefaults] setBool:(!showingDetails) forKey:@"ViewCollapsed"];
- [[NSUserDefaults standardUserDefaults] synchronize];
-}
-
-- (void)setReraiseExceptions:(BOOL)reraiseExceptions {
- [[NSUserDefaults standardUserDefaults] setBool:reraiseExceptions forKey:@"ReraiseExceptions"];
- [[NSUserDefaults standardUserDefaults] synchronize];
-}
-
-- (BOOL)reraiseExceptions {
- return [[NSUserDefaults standardUserDefaults] boolForKey:@"ReraiseExceptions"];
-}
-
-- (void)setRunInParallel:(BOOL)runInParallel {
- [[NSUserDefaults standardUserDefaults] setBool:runInParallel forKey:@"RunInParallel"];
- [[NSUserDefaults standardUserDefaults] synchronize];
-}
-
-- (BOOL)runInParallel {
- return [[NSUserDefaults standardUserDefaults] boolForKey:@"RunInParallel"];
-}
-
-- (void)hideDetails {
- [_detailsView removeFromSuperview];
- [_detailsToggleButton setState:NSOffState];
- [self setShowingDetails:NO];
-}
-
-- (void)showDetails {
- CGFloat windowWidth = self.view.window.frame.size.width;
- CGFloat minWindowWidth = MIN_WINDOW_WIDTH;
- if (windowWidth < minWindowWidth) {
- NSRect frame = self.view.window.frame;
- frame.size.width = minWindowWidth;
- [self.view.window setFrame:frame display:YES animate:YES];
- }
- [_splitView addSubview:_detailsView];
- [_detailsToggleButton setState:NSOnState];
- [self setShowingDetails:YES];
-}
-
-- (IBAction)toggleDetails:(id)sender {
- if ([self isShowingDetails]) {
- [self hideDetails];
- } else {
- [self showDetails];
- }
-}
-
-- (void)loadDefaults {
- if (![self isShowingDetails]) {
- [self hideDetails];
- }
-}
-
-- (void)saveDefaults {
- [dataSource_ saveDefaults];
- [[NSUserDefaults standardUserDefaults] setInteger:_textSegmentedControl.selectedSegment forKey:@"TextSelectedSegment"];
- [[NSUserDefaults standardUserDefaults] synchronize];
-}
-
-- (NSString *)_formatText:(NSString *)text {
- if (text) return [NSString stringWithFormat:@"%@\n", text]; // Newline important for when we append streaming text
- return @"";
-}
-
-- (NSString *)stackTraceForSelectedRow:(id<GHTest>)test {
- if (![test exception]) return @"";
- NSString *text = [GHTesting descriptionForException:[test exception]];
- return [self _formatText:text];
-}
-
-- (NSString *)logForSelectedRow:(id<GHTest>)test {
- NSString *text = [[test log] componentsJoinedByString:@"\n"]; // TODO(gabe): This isn't very performant
- return [self _formatText:text];
-}
-
-- (NSString *)textForSegment:(NSInteger)segment test:(id<GHTest>)test {
- if (!test) return @"";
- switch(segment) {
- case 0: return [self stackTraceForSelectedRow:test];
- case 1: return [self logForSelectedRow:test];
- }
- return nil;
-}
-
-- (void)_updateDetailForTest:(id<GHTest>)test prefix:(NSString *)prefix {
- NSMutableString *text = [NSMutableString string];
- if (prefix) [text appendFormat:@"\n\t%@\n\n", prefix];
- NSString *testDetail = [self textForSegment:[_textSegmentedControl selectedSegment] test:test];
- if (testDetail) [text appendString:testDetail];
- [_textView setString:text];
- self.exceptionFilename = [GHTesting exceptionFilenameForTest:test];
- self.exceptionLineNumber = [GHTesting exceptionLineNumberForTest:test];
-}
-
-- (IBAction)updateTextSegment:(id)sender {
- [self _updateDetailForTest:[self selectedTest] prefix:nil];
-}
-
-- (GHTestNode *)selectedNode {
- NSInteger row = [_outlineView selectedRow];
- if (row < 0) return nil;
- return [_outlineView itemAtRow:row];
-}
-
-- (id<GHTest>)selectedTest {
- return [self selectedNode].test;
-}
-
-- (void)selectFirstFailure {
- GHTestNode *failedNode = [dataSource_ findFailure];
- NSInteger row = [_outlineView rowForItem:failedNode];
- if (row >= 0) {
- [self selectRow:row];
- }
-}
-
-- (void)selectRow:(NSInteger)row {
- if (row >= 0)
- [_outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
-
- [_textView setString:@""];
-
- [self updateTextSegment:_textSegmentedControl];
-
- self.exceptionFilename = [[self selectedNode] exceptionFilename];
- self.exceptionLineNumber = [[self selectedNode] exceptionLineNumber];
-
-}
-
-- (void)_updateTest:(id<GHTest>)test {
- GHTestNode *testNode = [dataSource_ findTestNodeForTest:test];
- [_outlineView reloadItem:testNode];
-
- NSInteger runCount = [suite_ stats].succeedCount + [suite_ stats].failureCount;
- NSInteger totalRunCount = [suite_ stats].testCount - ([suite_ disabledCount] + [suite_ stats].cancelCount);
- if (dataSource_.isRunning)
- self.statusProgress = ((double)runCount/(double)totalRunCount) * 100.0;
- self.status = [dataSource_ statusString:@"Status: "];
-}
-
-#pragma mark Delegates (GHTestOutlineViewModel)
-
-- (void)testOutlineViewModelDidChangeSelection:(GHTestOutlineViewModel *)testOutlineViewModel {
- [self selectRow:-1];
-}
-
-#pragma mark Delegates (GHTestRunner)
-
-- (void)testRunner:(GHTestRunner *)runner didLog:(NSString *)message {
-
-}
-
-- (void)testRunner:(GHTestRunner *)runner test:(id<GHTest>)test didLog:(NSString *)message {
- id<GHTest> selectedTest = self.selectedTest;
- if ([_textSegmentedControl selectedSegment] == 1 && [selectedTest isEqual:test]) {
- [_textView replaceCharactersInRange:NSMakeRange([[_textView string] length], 0)
- withString:[NSString stringWithFormat:@"%@\n", message]];
- // TODO(gabe): Scroll
- }
-}
-
-- (void)testRunner:(GHTestRunner *)runner didStartTest:(id<GHTest>)test {
- [self _updateTest:test];
-}
-
-- (void)testRunner:(GHTestRunner *)runner didUpdateTest:(id<GHTest>)test {
- [self _updateTest:test];
-}
-
-- (void)testRunner:(GHTestRunner *)runner didEndTest:(id<GHTest>)test {
- [self _updateTest:test];
- [self updateTextSegment:nil]; // In case test is selected before it ran
-}
-
-- (void)testRunnerDidStart:(GHTestRunner *)runner {
- self.running = YES;
- [self _updateTest:runner.test];
-}
-
-- (void)testRunnerDidEnd:(GHTestRunner *)runner {
- GHUDebug(@"Test runner end: %@", [runner.test identifier]);
- [self _updateTest:runner.test];
- self.status = [dataSource_ statusString:@"Status: "];
- //[self selectFirstFailure];
- // TODO(gabe): This should be unnecessary
- self.statusProgress = 100.0;
- self.runLabel = @"Run";
- [dataSource_ saveDefaults];
- self.running = NO;
-
- if (getenv("GHUNIT_AUTOEXIT")) {
- NSLog(@"Exiting (GHUNIT_AUTOEXIT)");
- exit((int)runner.test.stats.failureCount);
- [NSApp terminate:self];
- }
-}
-
-- (void)testRunnerDidCancel:(GHTestRunner *)runner {
- self.runLabel = @"Run";
- self.status = [dataSource_ statusString:@"Cancelled... "];
- self.statusProgress = 0;
- self.running = NO;
-}
-
-#pragma mark Delegates (NSSplitView)
-
-- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex {
- return 300;
-}
-
-- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex {
- return [self view].frame.size.width - 335;
-}
-
-@end
View
1,538 Classes-MacOSX/UI/GHTestWindow.xib
0 additions, 1,538 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
41 Classes-MacOSX/UI/GHTestWindowController.h
@@ -1,41 +0,0 @@
-//
-// GHTestWindowController.h
-// GHKit
-//
-// Created by Gabriel Handford on 1/17/09.
-// Copyright 2009. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import "GHTestViewController.h"
-
-@interface GHTestWindowController : NSWindowController {
- GHTestViewController *viewController_;
-}
-
-@property (strong, nonatomic) IBOutlet GHTestViewController *viewController;
-
-- (IBAction)runTests:(id)sender;
-- (IBAction)copy:(id)sender;
-
-@end
View
70 Classes-MacOSX/UI/GHTestWindowController.m
@@ -1,70 +0,0 @@
-//
-// GHTestWindowController.m
-// GHKit
-//
-// Created by Gabriel Handford on 1/17/09.
-// Copyright 2009. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import "GHTestWindowController.h"
-
-
-@implementation GHTestWindowController
-
-@synthesize viewController=viewController_;
-
-- (id)init {
- return [super initWithWindowNibName:@"GHTestWindow"];
-}
-
-- (void)awakeFromNib {
- viewController_ = [[GHTestViewController alloc] init];
- [viewController_ loadTestSuite];
- [viewController_ loadDefaults];
- self.window.contentView = viewController_.view;
- NSString *bundleVersion = [[NSBundle bundleForClass:[self class]] objectForInfoDictionaryKey:@"CFBundleVersion"];
- self.window.title = [NSString stringWithFormat:@"GHUnit %@", bundleVersion];
-
- if (getenv("GHUNIT_AUTORUN")) [self runTests:nil];
-}
-
-- (IBAction)runTests:(id)sender {
- [viewController_ runTests];
-}
-
-- (IBAction)copy:(id)sender {
- [viewController_ copy:sender];
-}
-
-
-- (void)windowWillClose:(NSNotification *)notification {
- [[NSApplication sharedApplication] terminate:self];
-}
-
-- (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)frameSize {
- if ([viewController_ isShowingDetails] && frameSize.width < MIN_WINDOW_WIDTH) return sender.frame.size;
- return frameSize;
-}
-
-@end
View
49 Classes-iOS/GHImageDiffView.h
@@ -1,49 +0,0 @@
-//
-// GHImageDiffView.h
-// GHUnitIOS
-//
-// Created by John Boiles on 10/27/11.
-// Copyright (c) 2011. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface GHImageDiffView : UIView {
- UIScrollView *scrollView_;
- UISegmentedControl *segmentedControl_;
-
- UIImageView *savedImageView_;
- UIImageView *renderedImageView_;
- UIImageView *diffImageView_;
-}
-
-- (void)setSavedImage:(UIImage *)savedImage renderedImage:(UIImage *)renderedImage diffImage:(UIImage *)diffImage;
-
-- (void)showSavedImage;
-
-- (void)showRenderedImage;
-
-- (void)showDiffImage;
-
-@end
View
109 Classes-iOS/GHImageDiffView.m
@@ -1,109 +0,0 @@
-//
-// GHImageDiffView.m
-// GHUnitIOS
-//
-// Created by John Boiles on 10/27/11.
-// Copyright (c) 2011. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import "GHImageDiffView.h"
-
-@implementation GHImageDiffView
-
-- (id)initWithFrame:(CGRect)frame {
- if ((self = [super initWithFrame:frame])) {
- scrollView_ = [[UIScrollView alloc] initWithFrame:CGRectZero];
- scrollView_.backgroundColor = [UIColor scrollViewTexturedBackgroundColor];
- scrollView_.contentInset = UIEdgeInsetsMake(0, 0, 50, 0);
- [self addSubview:scrollView_];
-
- segmentedControl_ = [[UISegmentedControl alloc] initWithFrame:CGRectZero];
- [segmentedControl_ insertSegmentWithTitle:@"Saved" atIndex:0 animated:NO];
- [segmentedControl_ insertSegmentWithTitle:@"New" atIndex:1 animated:NO];
- [segmentedControl_ insertSegmentWithTitle:@"Diff" atIndex:2 animated:NO];
- [segmentedControl_ addTarget:self action:@selector(segmentedControlDidChange:) forControlEvents:UIControlEventValueChanged];
- [self addSubview:segmentedControl_];
-
- savedImageView_ = [[UIImageView alloc] initWithFrame:CGRectZero];
- [scrollView_ addSubview:savedImageView_];
-
- renderedImageView_ = [[UIImageView alloc] initWithFrame:CGRectZero];
- [scrollView_ addSubview:renderedImageView_];
-
- diffImageView_ = [[UIImageView alloc] initWithFrame:CGRectZero];
- [scrollView_ addSubview:diffImageView_];
- }
- return self;
-}
-
-- (void)layoutSubviews {
- [super layoutSubviews];
- scrollView_.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
-
- segmentedControl_.frame = CGRectMake((self.frame.size.width - 300) / 2, self.frame.size.height - 40, 300, 30);
-}
-
-- (void)setSavedImage:(UIImage *)savedImage renderedImage:(UIImage *)renderedImage diffImage:(UIImage *)diffImage {
- savedImageView_.image = savedImage;
- [savedImageView_ sizeToFit];
- [segmentedControl_ setEnabled:!!savedImage forSegmentAtIndex:0];
- renderedImageView_.image = renderedImage;
- [renderedImageView_ sizeToFit];
- [segmentedControl_ setEnabled:!!renderedImage forSegmentAtIndex:1];
- diffImageView_.image = diffImage;
- [diffImageView_ sizeToFit];
- [segmentedControl_ setEnabled:!!diffImage forSegmentAtIndex:2];
- scrollView_.contentSize = CGSizeMake(MAX(savedImage.size.width, renderedImage.size.width), MAX(savedImage.size.height, renderedImage.size.height));
-}
-
-- (void)showSavedImage {
- savedImageView_.hidden = NO;
- renderedImageView_.hidden = YES;
- diffImageView_.hidden = YES;
- segmentedControl_.selectedSegmentIndex = 0;
-}
-
-- (void)showRenderedImage {
- savedImageView_.hidden = YES;
- renderedImageView_.hidden = NO;
- diffImageView_.hidden = YES;
- segmentedControl_.selectedSegmentIndex = 1;
-}
-
-- (void)showDiffImage {
- savedImageView_.hidden = YES;
- renderedImageView_.hidden = YES;
- diffImageView_.hidden = NO;
- segmentedControl_.selectedSegmentIndex = 2;
-}
-
-#pragma mark UISegmentedControl
-
-- (void)segmentedControlDidChange:(UISegmentedControl *)segmentedControl {
- if (segmentedControl.selectedSegmentIndex == 0) [self showSavedImage];
- else if (segmentedControl.selectedSegmentIndex == 1) [self showRenderedImage];
- else if (segmentedControl.selectedSegmentIndex == 2) [self showDiffImage];
-}
-
-@end
View
41 Classes-iOS/GHUIImageViewControl.h
@@ -1,41 +0,0 @@
-//
-// GHUIImageViewControl.h
-// GHUnitIOS
-//
-// Created by Gabriel Handford on 4/1/11.
-// Copyright 2011. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface GHUIImageViewControl : UIControl {
- UIImageView *_imageView;
-}
-
-@property (readonly, nonatomic) UIImageView *imageView;
-@property (nonatomic) UIImage *image;
-
-- (id)initWithFrame:(CGRect)frame image:(UIImage *)image highlightedImage:(UIImage *)highlightedImage;
-
-@end
View
68 Classes-iOS/GHUIImageViewControl.m
@@ -1,68 +0,0 @@
-//
-// GHUIImageViewControl.m
-// GHUnitIOS
-//
-// Created by Gabriel Handford on 4/1/11.
-// Copyright 2011. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import "GHUIImageViewControl.h"
-
-
-@implementation GHUIImageViewControl
-
-@dynamic image;
-@synthesize imageView=_imageView;
-
-- (id)initWithFrame:(CGRect)frame {
- if ((self = [super initWithFrame:frame])) {
- _imageView = [[UIImageView alloc] init];
- [self addSubview:_imageView];
- }
- return self;
-}
-
-- (id)initWithFrame:(CGRect)frame image:(UIImage *)image highlightedImage:(UIImage *)highlightedImage {
- if ((self = [super initWithFrame:frame])) {
- _imageView = [[UIImageView alloc] initWithImage:image highlightedImage:highlightedImage];
- [self addSubview:_imageView];
- }
- return self;
-}
-
-- (void)layoutSubviews {
- [super layoutSubviews];
- _imageView.frame = self.bounds;
-}
-
-- (void)setHighlighted:(BOOL)highlighted {
- [super setHighlighted:highlighted];
- _imageView.highlighted = highlighted;
-}
-
-- (id)forwardingTargetForSelector:(SEL)aSelector {
- return _imageView;
-}
-
-@end
View
42 Classes-iOS/GHUnitIOSAppDelegate.h
@@ -1,42 +0,0 @@
-//
-// GHUnitIOSAppDelegate.h
-// GHUnitIOS
-//
-// Created by Gabriel Handford on 1/25/09.
-// Copyright 2009. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import <UIKit/UIKit.h>
-
-/*!
- Application delegate for the iOS test application.
- */
-@interface GHUnitIOSAppDelegate : NSObject <UIApplicationDelegate> {
- UIWindow *window_;
-
- UINavigationController *navigationController_;
-}
-
-@end
-
View
70 Classes-iOS/GHUnitIOSAppDelegate.m
@@ -1,70 +0,0 @@
-//
-// GHUnitIOSAppDelegate.m
-// GHUnitIOS
-//
-// Created by Gabriel Handford on 1/25/09.
-// Copyright 2009. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import "GHUnitIOSAppDelegate.h"
-#import "GHUnitIOSViewController.h"
-#import "GHUnit.h"
-
-@interface GHUnitIOSAppDelegate (Terminate)
-- (void)_terminateWithStatus:(int)status;
-@end
-
-@implementation GHUnitIOSAppDelegate
-
-- (void)applicationDidFinishLaunching:(UIApplication *)application {
- if (getenv("GHUNIT_CLI")) {
- int exitStatus = [GHTestRunner run];
- if ([application respondsToSelector:@selector(_terminateWithStatus:)]) {
- [(id)application _terminateWithStatus:exitStatus];
- } else {
- exit(exitStatus);
- }
- }
- GHUnitIOSViewController *viewController = [[GHUnitIOSViewController alloc] init];
- [viewController loadDefaults];
- navigationController_ = [[UINavigationController alloc] initWithRootViewController:viewController];
- CGSize size = [[UIScreen mainScreen] bounds].size;
- window_ = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, size.width, size.height)];
- window_.rootViewController = navigationController_;
- [window_ addSubview:navigationController_.view];
- [window_ makeKeyAndVisible];
-
- // Delete all interim saved images from previous UI tests
- [GHViewTestCase clearTestImages];
-
- if (getenv("GHUNIT_AUTORUN")) [viewController runTests];
-}
-
-- (void)applicationWillTerminate:(UIApplication *)application {
- // Called only graceful terminate; Closing simulator won't trigger this
- [[[navigationController_ viewControllers] objectAtIndex:0] saveDefaults];
-}
-
-
-@end
View
44 Classes-iOS/GHUnitIOSTableViewDataSource.h
@@ -1,44 +0,0 @@
-//
-// GHUnitIOSTableViewDataSource.h
-// GHUnitIOS
-//
-// Created by Gabriel Handford on 5/5/09.
-// Copyright 2009. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import <UIKit/UIKit.h>
-#import "GHTestViewModel.h"
-
-/*
- Table view data source for iOS test application.
- */
-@interface GHUnitIOSTableViewDataSource : GHTestViewModel <UITableViewDataSource> {
-
-}
-
-- (GHTestNode *)nodeForIndexPath:(NSIndexPath *)indexPath;
-
-- (void)setSelectedForAllNodes:(BOOL)selected;
-
-@end
View
110 Classes-iOS/GHUnitIOSTableViewDataSource.m
@@ -1,110 +0,0 @@
-//
-// GHUnitIOSTableViewDataSource.m
-// GHUnitIOS
-//
-// Created by Gabriel Handford on 5/5/09.
-// Copyright 2009. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import "GHUnitIOSTableViewDataSource.h"
-
-@implementation GHUnitIOSTableViewDataSource
-
-- (GHTestNode *)nodeForIndexPath:(NSIndexPath *)indexPath {
- GHTestNode *sectionNode = [[[self root] children] objectAtIndex:indexPath.section];
- return [[sectionNode children] objectAtIndex:indexPath.row];
-}
-
-- (void)setSelectedForAllNodes:(BOOL)selected {
- for(GHTestNode *sectionNode in [[self root] children]) {
- for(GHTestNode *node in [sectionNode children]) {
- [node setSelected:selected];
- }
- }
-}
-
-#pragma mark Data Source (UITableView)
-
-- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
- NSInteger numberOfSections = [self numberOfGroups];
- if (numberOfSections > 0) return numberOfSections;
- return 1;
-}
-
-- (NSInteger)tableView:(UITableView *)table numberOfRowsInSection:(NSInteger)section {
- return [self numberOfTestsInGroup:section];
-}
-
-- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
- NSArray *children = [[self root] children];
- if ([children count] == 0) return nil;
- GHTestNode *sectionNode = [children objectAtIndex:section];
- return sectionNode.name;
-}
-
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- GHTestNode *sectionNode = [[[self root] children] objectAtIndex:indexPath.section];
- GHTestNode *node = [[sectionNode children] objectAtIndex:indexPath.row];
-
- static NSString *CellIdentifier = @"ReviewFeedViewItem";
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
- if (!cell)
- cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
-
- if (editing_) {
- cell.textLabel.text = node.name;
- } else {
- cell.textLabel.text = [NSString stringWithFormat:@"%@ %@", node.name, node.statusString];
- }
-
- cell.textLabel.textColor = [UIColor lightGrayColor];
- cell.textLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:14];
-
- if (editing_) {
- if (node.isSelected) cell.textLabel.textColor = [UIColor blackColor];
- } else {
- if ([node status] == GHTestStatusRunning) {
- cell.textLabel.textColor = [UIColor blackColor];
- } else if ([node status] == GHTestStatusErrored) {
- if ([node.test.exception.name isEqualToString:@"GHViewUnavailableException"]) {
- cell.textLabel.textColor = [UIColor colorWithRed:0.6f green:0.6f blue:0.0f alpha:1.0f];
- } else {
- cell.textLabel.textColor = [UIColor redColor];
- }
- } else if ([node status] == GHTestStatusSucceeded) {
- cell.textLabel.textColor = [UIColor blackColor];
- } else if (node.isSelected) {
- if (node.isSelected) cell.textLabel.textColor = [UIColor darkGrayColor];
- }
- }
-
- UITableViewCellAccessoryType accessoryType = UITableViewCellAccessoryNone;
- if (self.isEditing && node.isSelected) accessoryType = UITableViewCellAccessoryCheckmark;
- else if (node.isEnded) accessoryType = UITableViewCellAccessoryDisclosureIndicator;
- cell.accessoryType = accessoryType;
-
- return cell;
-}
-
-@end
View
59 Classes-iOS/GHUnitIOSTestView.h
@@ -1,59 +0,0 @@
-//
-// GHUnitIOSTestView.h
-// GHUnitIOS
-//
-// Created by John Boiles on 8/8/11.
-// Copyright 2011. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import <UIKit/UIKit.h>
-#import "GHUIImageViewControl.h"
-
-@class GHUnitIOSTestView;
-
-@protocol GHUnitIOSTestViewDelegate <NSObject>
-- (void)testViewDidSelectSavedImage:(GHUnitIOSTestView *)testView;
-- (void)testViewDidSelectRenderedImage:(GHUnitIOSTestView *)testView;
-- (void)testViewDidApproveChange:(GHUnitIOSTestView *)testView;
-@end
-
-@interface GHUnitIOSTestView : UIScrollView {
- id<GHUnitIOSTestViewDelegate> __unsafe_unretained controlDelegate_;
-
- // TODO(johnb): Perhaps hold a scrollview here as subclassing UIViews can be weird.
-
- GHUIImageViewControl *savedImageView_;
- GHUIImageViewControl *renderedImageView_;
-
- UIButton *approveButton_;
-
- UILabel *textLabel_;
-}
-@property(unsafe_unretained, nonatomic) id<GHUnitIOSTestViewDelegate> controlDelegate;
-
-- (void)setSavedImage:(UIImage *)savedImage renderedImage:(UIImage *)renderedImage text:(NSString *)text;
-
-- (void)setText:(NSString *)text;
-
-@end
View
143 Classes-iOS/GHUnitIOSTestView.m
@@ -1,143 +0,0 @@
-//
-// GHUnitIOSTestView.m
-// GHUnitIOS
-//
-// Created by John Boiles on 8/8/11.
-// Copyright 2011. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import "GHUnitIOSTestView.h"
-#import <QuartzCore/QuartzCore.h>
-
-@implementation GHUnitIOSTestView
-
-@synthesize controlDelegate=controlDelegate_;
-
-- (id)initWithFrame:(CGRect)frame {
- if ((self = [super initWithFrame:frame])) {
- self.backgroundColor = [UIColor whiteColor];
-
- textLabel_ = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 300, 100)];
- textLabel_.font = [UIFont systemFontOfSize:12];
- textLabel_.textColor = [UIColor blackColor];
- textLabel_.numberOfLines = 0;
- [self addSubview:textLabel_];
-
- savedImageView_ = [[GHUIImageViewControl alloc] initWithFrame:CGRectMake(10, 10, 145, 100)];
- [savedImageView_ addTarget:self action:@selector(_selectSavedImage) forControlEvents:UIControlEventTouchUpInside];
- [savedImageView_.layer setBorderWidth:2.0];
- [savedImageView_.layer setBorderColor:[UIColor blackColor].CGColor];
- savedImageView_.hidden = YES;
- [self addSubview:savedImageView_];
-
- renderedImageView_ = [[GHUIImageViewControl alloc] initWithFrame:CGRectMake(165, 10, 145, 100)];
- [renderedImageView_ addTarget:self action:@selector(_selectRenderedImage) forControlEvents:UIControlEventTouchUpInside];
- [renderedImageView_.layer setBorderWidth:2.0];
- [renderedImageView_.layer setBorderColor:[UIColor blackColor].CGColor];
- renderedImageView_.hidden = YES;
- [self addSubview:renderedImageView_];
-
- approveButton_ = [UIButton buttonWithType:UIButtonTypeRoundedRect];
- [approveButton_ addTarget:self action:@selector(_approveChange) forControlEvents:UIControlEventTouchUpInside];
- approveButton_.hidden = YES;
- [approveButton_ setTitle:@"Approve this change" forState:UIControlStateNormal];
- [approveButton_ setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- approveButton_.titleLabel.font = [UIFont fontWithName:@"Helvetica" size:18];
- [self addSubview:approveButton_];
- }
- return self;
-}
-
-/*
- Real layout is not in layoutSubviews since scrollviews call layoutSubviews on every frame
- */
-- (void)_layout {
- CGFloat y = 10;
- CGRect savedImageFrame = CGRectZero;
- CGRect renderedImageFrame = CGRectZero;
-
- CGRect textLabelFrame = textLabel_.frame;
- textLabelFrame.size.height = [textLabel_.text sizeWithFont:textLabel_.font constrainedToSize:CGSizeMake(textLabel_.frame.size.width, 10000) lineBreakMode:UILineBreakModeWordWrap].height;
- textLabel_.frame = textLabelFrame;
-
- if (savedImageView_.image && !savedImageView_.hidden) {
- // Adjust image views to their sizes, maintaining constant width
- CGFloat aspectRatio = savedImageView_.image.size.height / savedImageView_.image.size.width;
- savedImageFrame = savedImageView_.frame;
- savedImageFrame.size.height = aspectRatio * savedImageFrame.size.width;
- savedImageView_.frame = savedImageFrame;
- }
-
- if (renderedImageView_.image && !renderedImageView_.hidden) {
- CGFloat aspectRatio = renderedImageView_.image.size.height / renderedImageView_.image.size.width;
- renderedImageFrame = renderedImageView_.frame;
- renderedImageFrame.size.height = aspectRatio * renderedImageFrame.size.width;
- renderedImageView_.frame = renderedImageFrame;
- }
-
- y += roundf(MAX(savedImageFrame.size.height, renderedImageFrame.size.height) + 10);
-
- if (!approveButton_.hidden) {
- approveButton_.frame = CGRectMake(10, y, 300, 30);
- y += 40;
- }
-
- CGRect textViewFrame = textLabel_.frame;
- textViewFrame.origin.y = y;
- textLabel_.frame = textViewFrame;
-
- self.contentSize = CGSizeMake(self.frame.size.width, textViewFrame.origin.y + textViewFrame.size.height + 10);
-}
-
-- (void)_selectSavedImage {
- [controlDelegate_ testViewDidSelectSavedImage:self];
-}
-
-- (void)_selectRenderedImage {
- [controlDelegate_ testViewDidSelectRenderedImage:self];
-}
-
-- (void)_approveChange {
- [controlDelegate_ testViewDidApproveChange:self];
-}
-
-- (void)setSavedImage:(UIImage *)savedImage renderedImage:(UIImage *)renderedImage text:(NSString *)text {
- savedImageView_.image = savedImage;
- savedImageView_.hidden = savedImage ? NO : YES;
- renderedImageView_.image = renderedImage;
- renderedImageView_.hidden = NO;
- approveButton_.hidden = NO;
- textLabel_.text = text;
- [self _layout];
-}
-
-- (void)setText:(NSString *)text {
- savedImageView_.hidden = YES;
- renderedImageView_.hidden = YES;
- approveButton_.hidden = YES;
- textLabel_.text = text;
- [self _layout];
-}
-
-@end
View
49 Classes-iOS/GHUnitIOSTestViewController.h
@@ -1,49 +0,0 @@
-//
-// GHUnitIOSTestViewController.h
-// GHUnitIOS
-//
-// Created by Gabriel Handford on 2/20/09.
-// Copyright 2009. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import <UIKit/UIKit.h>
-#import "GHTestViewModel.h"
-#import "GHUnitIOSTestView.h"
-#import "GHImageDiffView.h"
-
-/*
- View controller for a test.
- */
-@interface GHUnitIOSTestViewController : UIViewController <GHTestRunnerDelegate, GHUnitIOSTestViewDelegate> {
- GHUnitIOSTestView *testView_;
- GHImageDiffView *imageDiffView_;
-
- GHTestNode *testNode_;
-
- GHTestRunner *runner_;
-}
-
-- (void)setTest:(id<GHTest>)test;
-
-@end
View
126 Classes-iOS/GHUnitIOSTestViewController.m
@@ -1,126 +0,0 @@
-//
-// GHUnitIOSTestViewController.m
-// GHUnitIOS
-//
-// Created by Gabriel Handford on 2/20/09.
-// Copyright 2009. All rights reserved.
-//
-// Permission is hereby granted, free of charge, to any person
-// obtaining a copy of this software and associated documentation
-// files (the "Software"), to deal in the Software without
-// restriction, including without limitation the rights to use,
-// copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the
-// Software is furnished to do so, subject to the following
-// conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-// OTHER DEALINGS IN THE SOFTWARE.
-//
-
-#import "GHUnitIOSTestViewController.h"
-#import "GHViewTestCase.h"
-
-@implementation GHUnitIOSTestViewController
-
-- (id)init {
- if ((self = [super init])) {
- UIBarButtonItem *runButton = [[UIBarButtonItem alloc] initWithTitle:@"Re-run" style:UIBarButtonItemStyleDone
- target:self action:@selector(_runTest)];
- self.navigationItem.rightBarButtonItem = runButton;
- }
- return self;
-}
-
-
-- (void)loadView {
- testView_ = [[GHUnitIOSTestView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
- testView_.