Swift 单元测试 - 我如何断言 CGColor 是它应该是什么? [英] Swift Unit test- How do I assert that a CGColor is what it's supposed to be?

查看:24
本文介绍了Swift 单元测试 - 我如何断言 CGColor 是它应该是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 Xcode V7.2.尝试进行单元测试,需要验证是否设置了正确的颜色,并收到此消息:

Using Xcode V7.2. Trying to unit test, need to verify that the correct color has been set, and get this message:

Cannot invoke 'XCTAssertEqual' with an argument list of type '(CGColor, CGColor)'

我如何断言 CGColor 是它应有的样子?

How do I assert that a CGColor is what it's supposed to be?

推荐答案

使用 XCTAssert 并测试 CGColorEqualToColor 是否为真.

Use XCTAssert and test whether CGColorEqualToColor is true.

这篇关于Swift 单元测试 - 我如何断言 CGColor 是它应该是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆