From ce328d42c23498a56da05e2c093aa155cd67b8dd Mon Sep 17 00:00:00 2001 From: hengyi-zhang Date: Fri, 25 Oct 2024 22:53:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20[JIRA:IOSSDKBUG-414]=20Lo?= =?UTF-8?q?wer=20enumeration=20cases=20count=20(#836)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lower enumeration cases count temporarily to prevent crash --- .../FioriThemeManager/Colors/ColorStyle.swift | 52 ++++++++++--------- .../Palettes/PaletteV8.swift | 8 +-- .../FioriThemeManager/ThemeManagerTests.swift | 22 ++++---- 3 files changed, 42 insertions(+), 40 deletions(-) diff --git a/Sources/FioriThemeManager/Colors/ColorStyle.swift b/Sources/FioriThemeManager/Colors/ColorStyle.swift index cd18bbd19..13636b984 100644 --- a/Sources/FioriThemeManager/Colors/ColorStyle.swift +++ b/Sources/FioriThemeManager/Colors/ColorStyle.swift @@ -1163,30 +1163,30 @@ public enum ColorStyle: String, CaseIterable { /// (light variant) ![](https://dummyimage.com/48x18/F83030.png&text=+) Hex value: F83030FF @available(watchOS, unavailable) case stockDownStroke - - /// ChartBad - /// (dark variant) ![](https://dummyimage.com/48x18/F53232.png&text=+) Hex value: F53232FF - /// (light variant) ![](https://dummyimage.com/48x18/F83030.png&text=+) Hex value: F83030FF - @available(watchOS, unavailable) - case chartBad - - /// ChartCritical - /// (dark variant) ![](https://dummyimage.com/48x18/E26300.png&text=+) Hex value: E26300FF - /// (light variant) ![](https://dummyimage.com/48x18/DD6100.png&text=+) Hex value: DD6100FF - @available(watchOS, unavailable) - case chartCritical - - /// ChartGood - /// (dark variant) ![](https://dummyimage.com/48x18/30914C.png&text=+) Hex value: 30914CFF - /// (light variant) ![](https://dummyimage.com/48x18/30914C.png&text=+) Hex value: 30914CFF - @available(watchOS, unavailable) - case chartGood - - /// ChartNeutral - /// (dark variant) ![](https://dummyimage.com/48x18/6F89A1.png&text=+) Hex value: 6F89A1FF - /// (light variant) ![](https://dummyimage.com/48x18/758CA4.png&text=+) Hex value: 758CA4FF - @available(watchOS, unavailable) - case chartNeutral +// +// /// ChartBad +// /// (dark variant) ![](https://dummyimage.com/48x18/F53232.png&text=+) Hex value: F53232FF +// /// (light variant) ![](https://dummyimage.com/48x18/F83030.png&text=+) Hex value: F83030FF +// @available(watchOS, unavailable) +// case chartBad +// +// /// ChartCritical +// /// (dark variant) ![](https://dummyimage.com/48x18/E26300.png&text=+) Hex value: E26300FF +// /// (light variant) ![](https://dummyimage.com/48x18/DD6100.png&text=+) Hex value: DD6100FF +// @available(watchOS, unavailable) +// case chartCritical +// +// /// ChartGood +// /// (dark variant) ![](https://dummyimage.com/48x18/30914C.png&text=+) Hex value: 30914CFF +// /// (light variant) ![](https://dummyimage.com/48x18/30914C.png&text=+) Hex value: 30914CFF +// @available(watchOS, unavailable) +// case chartGood +// +// /// ChartNeutral +// /// (dark variant) ![](https://dummyimage.com/48x18/6F89A1.png&text=+) Hex value: 6F89A1FF +// /// (light variant) ![](https://dummyimage.com/48x18/758CA4.png&text=+) Hex value: 758CA4FF +// @available(watchOS, unavailable) +// case chartNeutral // MARK: - Map Colors (11 Styles) @@ -1642,7 +1642,9 @@ public enum ColorStyle: String, CaseIterable { .header, .headerBlended, .barTransparent, .contrastElement, .footer, .cellBackground, .chrome, .chromeSecondary, .chart1, .chart2, .chart3, .chart4, .chart5, .chart6, .chart7, .chart8, .chart9, .chart10, .chart11, .chart12, - .stockUpStroke, .stockDownStroke, .chartBad, .chartCritical, .chartNeutral, .chartGood, .map1, .map2, .map3, .map4, + .stockUpStroke, .stockDownStroke, +// .chartBad, .chartCritical, .chartNeutral, .chartGood, + .map1, .map2, .map3, .map4, .map5, .map6, .map7, .map8, .map9, .map10, .customColor1, .customColor2, .customColor3, .customColor4, .customColor5, .customColor6, .esriEdit, .jouleBrand, .jouleAccent1, .jouleAccent2, .jouleAccent3, .jouleGradient1, .jouleGradient2] #else diff --git a/Sources/FioriThemeManager/Palettes/PaletteV8.swift b/Sources/FioriThemeManager/Palettes/PaletteV8.swift index 6a3b61b19..bffacf95c 100644 --- a/Sources/FioriThemeManager/Palettes/PaletteV8.swift +++ b/Sources/FioriThemeManager/Palettes/PaletteV8.swift @@ -212,10 +212,10 @@ struct PaletteV8: PaletteProvider { .chart12: HexColor(lightColor: "A68A5BFF", darkColor: "A68A5BFF", contrastLightColor: "B49E78FF", contrastDarkColor: "816246FF"), .stockUpStroke: HexColor(lightColor: "30914CFF", darkColor: "30914CFF", contrastLightColor: "99CC99FF", contrastDarkColor: "006362FF"), .stockDownStroke: HexColor(lightColor: "F83030FF", darkColor: "F53232FF", contrastLightColor: "FF7878FF", contrastDarkColor: "AB0000FF"), - .chartBad: HexColor(lightColor: "F83030FF", darkColor: "F53232FF", contrastLightColor: "FF7878FF", contrastDarkColor: "AB0000FF"), - .chartCritical: HexColor(lightColor: "DD6100FF", darkColor: "E26300FF", contrastLightColor: "FFAB1DFF", contrastDarkColor: "5C5C00FF"), - .chartGood: HexColor(lightColor: "30914CFF", darkColor: "30914CFF", contrastLightColor: "99CC99FF", contrastDarkColor: "006362FF"), - .chartNeutral: HexColor(lightColor: "6F89A1FF", darkColor: "758CA4FF", contrastLightColor: "AFAFAFFF", contrastDarkColor: "525252FF"), +// .chartBad: HexColor(lightColor: "F83030FF", darkColor: "F53232FF", contrastLightColor: "FF7878FF", contrastDarkColor: "AB0000FF"), +// .chartCritical: HexColor(lightColor: "DD6100FF", darkColor: "E26300FF", contrastLightColor: "FFAB1DFF", contrastDarkColor: "5C5C00FF"), +// .chartGood: HexColor(lightColor: "30914CFF", darkColor: "30914CFF", contrastLightColor: "99CC99FF", contrastDarkColor: "006362FF"), +// .chartNeutral: HexColor(lightColor: "6F89A1FF", darkColor: "758CA4FF", contrastLightColor: "AFAFAFFF", contrastDarkColor: "525252FF"), /// Map Colors .map1: HexColor(lightColor: "2E4A62", darkColor: "2E4A62"), .map2: HexColor(lightColor: "56840E", darkColor: "56840E"), diff --git a/Tests/FioriSwiftUITests/FioriThemeManager/ThemeManagerTests.swift b/Tests/FioriSwiftUITests/FioriThemeManager/ThemeManagerTests.swift index 9d4a966be..588fd6efc 100644 --- a/Tests/FioriSwiftUITests/FioriThemeManager/ThemeManagerTests.swift +++ b/Tests/FioriSwiftUITests/FioriThemeManager/ThemeManagerTests.swift @@ -10,16 +10,16 @@ class ThemeManagerTests: XCTestCase { #if !os(watchOS) func testLatestColorStyle() throws { - XCTAssertEqual(ColorStyle.allCases.count, 216) + XCTAssertEqual(ColorStyle.allCases.count, 212) // 216 } func testPalette8() throws { let tm = ThemeManager.shared tm.setPaletteVersion(.v8) // following are same as v7 - XCTAssertEqual(tm.paletteVersion?.supportedStyles().count, 216) + XCTAssertEqual(tm.paletteVersion?.supportedStyles().count, 212) // 216 XCTAssertEqual(tm.paletteVersion?.obsoletedStyles().count, 0) - XCTAssertEqual(tm.paletteVersion?.newStyles().count, 21) + XCTAssertEqual(tm.paletteVersion?.newStyles().count, 17) // 21 let newStyle_grey1 = tm.hexColor(for: .grey1) XCTAssertEqual(newStyle_grey1, HexColor(lightColor: "12171CFF", darkColor: "F5F6F7FF", contrastLightColor: "1C242BFF", contrastDarkColor: "EAECEEFF")) let newStyle_primaryLabel = tm.hexColor(for: .primaryLabel) @@ -307,14 +307,14 @@ class ThemeManagerTests: XCTestCase { XCTAssertEqual(stockUpStroke, HexColor(lightColor: "30914CFF", darkColor: "30914CFF", contrastLightColor: "99CC99FF", contrastDarkColor: "006362FF")) let stockDownStroke = tm.hexColor(for: .stockDownStroke) XCTAssertEqual(stockDownStroke, HexColor(lightColor: "F83030FF", darkColor: "F53232FF", contrastLightColor: "FF7878FF", contrastDarkColor: "AB0000FF")) - let chartBad = tm.hexColor(for: .chartBad) - XCTAssertEqual(chartBad, HexColor(lightColor: "F83030FF", darkColor: "F53232FF", contrastLightColor: "FF7878FF", contrastDarkColor: "AB0000FF")) - let chartCritical = tm.hexColor(for: .chartCritical) - XCTAssertEqual(chartCritical, HexColor(lightColor: "DD6100FF", darkColor: "E26300FF", contrastLightColor: "FFAB1DFF", contrastDarkColor: "5C5C00FF")) - let chartGood = tm.hexColor(for: .chartGood) - XCTAssertEqual(chartGood, HexColor(lightColor: "30914CFF", darkColor: "30914CFF", contrastLightColor: "99CC99FF", contrastDarkColor: "006362FF")) - let chartNeutral = tm.hexColor(for: .chartNeutral) - XCTAssertEqual(chartNeutral, HexColor(lightColor: "6F89A1FF", darkColor: "758CA4FF", contrastLightColor: "AFAFAFFF", contrastDarkColor: "525252FF")) +// let chartBad = tm.hexColor(for: .chartBad) +// XCTAssertEqual(chartBad, HexColor(lightColor: "F83030FF", darkColor: "F53232FF", contrastLightColor: "FF7878FF", contrastDarkColor: "AB0000FF")) +// let chartCritical = tm.hexColor(for: .chartCritical) +// XCTAssertEqual(chartCritical, HexColor(lightColor: "DD6100FF", darkColor: "E26300FF", contrastLightColor: "FFAB1DFF", contrastDarkColor: "5C5C00FF")) +// let chartGood = tm.hexColor(for: .chartGood) +// XCTAssertEqual(chartGood, HexColor(lightColor: "30914CFF", darkColor: "30914CFF", contrastLightColor: "99CC99FF", contrastDarkColor: "006362FF")) +// let chartNeutral = tm.hexColor(for: .chartNeutral) +// XCTAssertEqual(chartNeutral, HexColor(lightColor: "6F89A1FF", darkColor: "758CA4FF", contrastLightColor: "AFAFAFFF", contrastDarkColor: "525252FF")) } func testPaletteV7() throws {