Skip to content

Commit

Permalink
Adding UIKit as a dependence for CoreGraphics UnitTests, this is due …
Browse files Browse the repository at this point in the history
…to CGColor is an instance of UIColor (which is lazy loaded).

Thus for CGColorTests to run we need the UIKit DLL to be loaded.
Note: The CGColorTests are appended with [UIColor class] to support the UIKit dll to be part of the test run.
  • Loading branch information
msft-Jeyaram committed Mar 20, 2017
1 parent c201cb3 commit f5d89da
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
<ProjectReference Include="..\..\..\CoreImage\dll\CoreImage.vcxproj">
<Project>{3EFCDFF3-6013-448F-8611-534D0F819D6B}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\UIKit\dll\UIKit.vcxproj">
<Project>{43D2CFE5-0711-4E61-8F5C-F8D3B65D3A49}</Project>
</ProjectReference>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{DA6C01EA-A22E-4807-BACE-63C5C6ABAE77}</ProjectGuid>
Expand Down
18 changes: 18 additions & 0 deletions tests/unittests/CoreGraphics/CGColorTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@
#import <TestFramework.h>
#import <CoreGraphics/CoreGraphics.h>

// TODO #2243: Remove the UIKit dependency
#if WINOBJC
#include <UIKit/UIColor.h>
#endif

#define EXPECT_EQ_COMPONENTS(a, b) \
EXPECT_EQ((a)[0], (b)[0]); \
EXPECT_EQ((a)[1], (b)[1]); \
EXPECT_EQ((a)[2], (b)[2]); \
EXPECT_EQ((a)[3], (b)[3])

TEST(CGColor, CGColorGetComponents) {
#if WINOBJC
[UIColor class];
#endif
CGFloat colors[] = { 1, 0, 0, 1 }; // bright red

CGColorSpaceRef clrRgb = CGColorSpaceCreateDeviceRGB();
Expand All @@ -49,6 +57,10 @@
}

TEST(CGColor, CGColorEquals) {
#if WINOBJC
[UIColor class];
#endif

CGFloat colors[] = { 1, 0, 0, 1 }; // bright red

CGColorSpaceRef clrRgb = CGColorSpaceCreateDeviceRGB();
Expand Down Expand Up @@ -80,6 +92,9 @@
}

TEST(CGColor, GetColorSpace) {
#if WINOBJC
[UIColor class];
#endif
CGFloat colors[] = { 1, 0, 0, 1 }; // bright red

CGColorSpaceRef clrRgb = CGColorSpaceCreateDeviceRGB();
Expand All @@ -101,6 +116,9 @@
}

TEST(CGColor, GetConstantColor) {
#if WINOBJC
[UIColor class];
#endif
auto grayColorSpace = woc::MakeStrongCF<CGColorSpaceRef>(CGColorSpaceCreateDeviceGray());

CFStringRef colors[] = { kCGColorWhite, kCGColorBlack, kCGColorClear };
Expand Down

0 comments on commit f5d89da

Please sign in to comment.