diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-07-27 17:00:45 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2009-07-27 17:00:45 +0000 |
commit | c9e416c3c74910d79fd548180584491b257b833b (patch) | |
tree | 98813297be9238782c7516da4e489d8da21c3b7e /UnitTesting | |
parent | 992bf43928c259fd791f16d8639f000195310017 (diff) |
[Author: thomasvl]
Support for NSMatrix in uistate files (dumps the cells and row/column counts).
Support for NSMatrix in GTMUILocalizer.
Added checkboxes and radio groups to the GTMUILocalizer unittest.
R=dmaclach
DELTA=551 (541 added, 0 deleted, 10 changed)
Diffstat (limited to 'UnitTesting')
-rw-r--r-- | UnitTesting/GTMAppKit+UnitTesting.h | 3 | ||||
-rw-r--r-- | UnitTesting/GTMAppKit+UnitTesting.m | 34 |
2 files changed, 37 insertions, 0 deletions
diff --git a/UnitTesting/GTMAppKit+UnitTesting.h b/UnitTesting/GTMAppKit+UnitTesting.h index 41fddf4..7ef5512 100644 --- a/UnitTesting/GTMAppKit+UnitTesting.h +++ b/UnitTesting/GTMAppKit+UnitTesting.h @@ -58,6 +58,9 @@ @interface NSTabViewItem (GTMUnitTestingAdditions) @end +@interface NSMatrix (GTMUnitTestingAdditions) +@end + @protocol GTMUnitTestViewDrawer; // Fails when the |a1|'s drawing in an area |a2| does not equal the image file named |a3|. diff --git a/UnitTesting/GTMAppKit+UnitTesting.m b/UnitTesting/GTMAppKit+UnitTesting.m index 9954301..e5e35e5 100644 --- a/UnitTesting/GTMAppKit+UnitTesting.m +++ b/UnitTesting/GTMAppKit+UnitTesting.m @@ -289,6 +289,40 @@ GTM_METHOD_CHECK(NSObject, gtm_unitTestEncodeState:); @end +@implementation NSMatrix (GTMUnitTestingAdditions) + +// Encodes the state of an object in a manner suitable for comparing +// against a master state file so we can determine whether the +// object is in a suitable state. +// +// Arguments: +// inCoder - the coder to encode our state into +- (void)gtm_unitTestEncodeState:(NSCoder*)inCoder { + [super gtm_unitTestEncodeState:inCoder]; + + ENCODE_NSINTEGER(inCoder, [self mode], @"MatrixMode"); + ENCODE_NSINTEGER(inCoder, [self numberOfRows], @"MatrixRowCount"); + ENCODE_NSINTEGER(inCoder, [self numberOfColumns], @"MatrixColumnCount"); + [inCoder encodeBool:[self allowsEmptySelection] + forKey:@"MatrixAllowEmptySelection"]; + [inCoder encodeBool:[self isSelectionByRect] forKey:@"MatrixSelectionByRect"]; + [inCoder encodeBool:[self autosizesCells] forKey:@"MatrixAutosizesCells"]; + [inCoder encodeSize:[self intercellSpacing] forKey:@"MatrixIntercellSpacing"]; + + [inCoder encodeObject:[self prototype] forKey:@"MatrixCellPrototype"]; + + // Dump the list of cells + NSCell *cell; + long i = 0; + GTM_FOREACH_OBJECT(cell, [self cells]) { + [inCoder encodeObject:cell + forKey:[NSString stringWithFormat:@"MatrixCell %ld", i]]; + ++i; + } +} + +@end + // A view that allows you to delegate out drawing using the formal // GTMUnitTestViewDelegate protocol above. This is useful when writing up unit // tests for visual elements. |