45 lines
1.3 KiB
Swift
45 lines
1.3 KiB
Swift
//
|
|
// HomeMenuIconFactoryTests.swift
|
|
// suixinkanTests
|
|
//
|
|
|
|
import UIKit
|
|
import XCTest
|
|
@testable import suixinkan
|
|
|
|
/// 首页菜单图标加载测试。
|
|
final class HomeMenuIconFactoryTests: XCTestCase {
|
|
|
|
func testAssetIconTakesPrecedence() {
|
|
let image = HomeMenuIconFactory.image(named: "home_menu_space")
|
|
|
|
XCTAssertNotNil(image)
|
|
XCTAssertNil(UIImage(systemName: "home_menu_space"))
|
|
}
|
|
|
|
func testSystemSymbolMatchesSharedConfiguration() {
|
|
let expected = UIImage(
|
|
systemName: "ellipsis",
|
|
withConfiguration: HomeMenuIconFactory.symbolConfiguration
|
|
)
|
|
let actual = HomeMenuIconFactory.image(named: "ellipsis")
|
|
|
|
XCTAssertNotNil(actual)
|
|
XCTAssertEqual(actual?.size, expected?.size)
|
|
}
|
|
|
|
func testSystemSymbolDiffersFromUnconfiguredDefault() {
|
|
let configured = HomeMenuIconFactory.image(named: "ellipsis")
|
|
let plain = UIImage(systemName: "ellipsis")
|
|
|
|
XCTAssertNotNil(configured)
|
|
XCTAssertNotNil(plain)
|
|
XCTAssertNotEqual(configured?.size, plain?.size)
|
|
}
|
|
|
|
func testComplexSystemSymbolResolves() {
|
|
XCTAssertNotNil(HomeMenuIconFactory.image(named: "dot.radiowaves.left.and.right"))
|
|
XCTAssertNotNil(HomeMenuIconFactory.image(named: "rectangle.stack.badge.plus"))
|
|
}
|
|
}
|