Permalink
Browse files

Add skeleton test for NSImage

  • Loading branch information...
1 parent 7d1164b commit 294f79d1c8d21f57aeede6a0e0d47d0f1c2d4dcb @sorbits sorbits committed Aug 27, 2012
Showing with 32 additions and 0 deletions.
  1. +32 −0 Frameworks/OakAppKit/tests/t_resize_image.mm
@@ -0,0 +1,32 @@
+#import <OakAppKit/OakFileIconImage.h>
+#import <OakAppKit/NSImage Additions.h>
+#import <test/cocoa.h>
+#import <oak/oak.h>
+
+@interface MyImageView : NSView
+{
+ NSImage* image;
+}
+@property (nonatomic, retain) NSImage* image;
+@end
+
+@implementation MyImageView
+@synthesize image;
+
+- (void)drawRect:(NSRect)aRect
+{
+ NSEraseRect(aRect);
+ if(!image)
+ self.image = [OakFileIconImage fileIconImageWithPath:NSHomeDirectory() size:NSMakeSize(16, 16)];
+ [self.image drawAdjustedInRect:NSMakeRect(0, 0, NSWidth(self.frame), NSHeight(self.frame)) fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1];
+}
+@end
+
+class ResizeImageTests : public CxxTest::TestSuite
+{
+public:
+ void test_resize_image ()
+ {
+ OakSetupApplicationWithView([[MyImageView alloc] initWithFrame:NSMakeRect(0, 0, 200, 50)], "resize_image");
+ }
+};

0 comments on commit 294f79d

Please sign in to comment.