diff --git a/ios/FluentUI.Tests/AvatarTests.swift b/ios/FluentUI.Tests/AvatarTests.swift index 1daad5c001..7a3058a585 100644 --- a/ios/FluentUI.Tests/AvatarTests.swift +++ b/ios/FluentUI.Tests/AvatarTests.swift @@ -4,17 +4,10 @@ // import XCTest -import FluentUI +@testable import FluentUI class AvatarTests: XCTestCase { - /// Validates that the number of colors defined for tokens textCalculatedBackgroundColors and textCalculatedForegroundColors are the same. - func testTextCalculatedBackgroundForegroundColorsCount() { - XCTAssertEqual(FluentUIThemeManager.S.MSFAvatarTokens.textCalculatedBackgroundColors.count, - FluentUIThemeManager.S.MSFAvatarTokens.textCalculatedForegroundColors.count, - "Text calculated background and foreground colors should provide the same number of options.") - } - /// Validates that the background and foreground colors for a given index in both arrays (textCalculatedBackgroundColors and textCalculatedForegroundColors tokens) match comparing: /// 1. A color light mode background color with its counterpart dark mode foreground color. The color should be the same (tint40) /// 2. A color light mode foreground color with its counterpart dark mode background color. The color should be the same (shade30) @@ -27,8 +20,9 @@ class AvatarTests: XCTestCase { /// - Background: shade30 /// - Foreground: tint40 func testTextCalculatedBackgroundForegroundColorsMatch() { - let bgColors = FluentUIThemeManager.S.MSFAvatarTokens.textCalculatedBackgroundColors - let fgColors = FluentUIThemeManager.S.MSFAvatarTokens.textCalculatedForegroundColors + let colors = Avatar.CalculatedColors.colors + let bgColors = (0.. + skipped = "NO"> UIColor { let colorSet = colors[hashCode % colors.count] return UIColor(light: GlobalTokens.sharedColor(colorSet, .tint40), @@ -492,7 +492,7 @@ public struct Avatar: View, TokenizedControlView { /// Hash algorithm to determine Avatar color. /// Referenced from: https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-avatar/src/components/Avatar/useAvatar.tsx#L200 /// - Returns: Hash code - private static func hashCode(_ text: NSString) -> Int32 { + static func hashCode(_ text: NSString) -> Int32 { var hash: Int32 = 0 for len in (0..