aboutsummaryrefslogtreecommitdiff
path: root/UnitTesting
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-07-12 17:07:19 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2010-07-12 17:07:19 +0000
commite2bb8aa49243734ea094c0c81a072f7570507d95 (patch)
treee484921bc047c953593819787ff91f49af2daa20 /UnitTesting
parent4d5b01da0879f09e3777cf423bed5d3db5d2e149 (diff)
[Author: rsesek]
Add support for NSSegmentedControl to GTMUILocalizer. This fixes http://code.google.com/p/google-toolbox-for-mac/issues/detail?id=53. R=dmaclach APPROVED=dmaclach DELTA=142 (137 added, 1 deleted, 4 changed)
Diffstat (limited to 'UnitTesting')
-rw-r--r--UnitTesting/GTMAppKit+UnitTesting.m20
1 files changed, 20 insertions, 0 deletions
diff --git a/UnitTesting/GTMAppKit+UnitTesting.m b/UnitTesting/GTMAppKit+UnitTesting.m
index ad883e4..1fc0dc1 100644
--- a/UnitTesting/GTMAppKit+UnitTesting.m
+++ b/UnitTesting/GTMAppKit+UnitTesting.m
@@ -425,6 +425,26 @@ GTM_METHOD_CHECK(NSObject, gtm_unitTestEncodeState:);
@end
+@implementation NSSegmentedControl (GTMUnitTestingAdditions)
+
+// Encodes the state of an NSSegmentedControl and all its segments.
+//
+// Arguments:
+// inCoder - the coder to encode state into
+- (void)gtm_unitTestEncodeState:(NSCoder*)inCoder {
+ [super gtm_unitTestEncodeState:inCoder];
+
+ NSInteger segmentCount = [self segmentCount];
+ ENCODE_NSINTEGER(inCoder, segmentCount, @"SegmentCount");
+
+ for (NSInteger i = 0; i < segmentCount; ++i) {
+ NSString *key = [NSString stringWithFormat:@"Segment %d", i];
+ [inCoder encodeObject:[self labelForSegment:i] forKey:key];
+ }
+}
+
+@end
+
@implementation NSView (GTMUnitTestingAdditions)
// Returns an image containing a representation of the object