-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: tests for override of semantic tokens for opacity (#340)
Signed-off-by: Pierre-Yves Lapersonne <pierreyves.lapersonne@orange.com>
- Loading branch information
Showing
3 changed files
with
64 additions
and
70 deletions.
There are no files selected for viewing
69 changes: 0 additions & 69 deletions
69
.../Themes/Orange/Tests/Values/SemanticTokens/TestThemeOverrideOfOpacitySemanticTokens.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...Themes/Orange/Tests/Values/SemanticTokens/ThemeOverrideOfOpacitySemanticTokensTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// | ||
// Software Name: OUDS iOS | ||
// SPDX-FileCopyrightText: Copyright (c) Orange SA | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// This software is distributed under the MIT license, | ||
// the text of which is available at https://opensource.org/license/MIT/ | ||
// or see the "LICENSE" file for more details. | ||
// | ||
// Authors: See CONTRIBUTORS.txt | ||
// Software description: A SwiftUI components library with code examples for Orange Unified Design System | ||
// | ||
|
||
import OUDS | ||
import OUDSThemesOrange | ||
import Testing | ||
|
||
/// The architecture of _OUDS iOS_ _Swift package_ library is based on _object oriented paradigm_ and overriding of classes. | ||
/// In factn the `OUDSTheme` object is a class, which can be seens as an _asbtract class_, exposing through its extensions and protocols _opacity semantic tokens_. | ||
/// These semantic tokens should be overridable by subclasses like the ``OrangeThemeOpacitySemanticTokensProvider``. | ||
/// | ||
/// **These tests checks if any _opacity semantic tokens_ can be surcharged by a child theme** | ||
/// **Also, it can help to find removed or renamed tokens by having tests no more compilable** | ||
struct ThemeOverrideOfOpacitySemanticTokensTests { | ||
|
||
private var abstractTheme: OUDSTheme | ||
private var inheritedTheme: OUDSTheme | ||
|
||
init() { | ||
abstractTheme = OrangeTheme() | ||
inheritedTheme = MockTheme() | ||
} | ||
|
||
@Test func inheritedThemeCanOverrideSemanticTokenOpacityInvisible() throws { | ||
#expect(inheritedTheme.opacities.opacityInvisible != abstractTheme.opacities.opacityInvisible) | ||
#expect(inheritedTheme.opacities.opacityInvisible == MockThemeOpacitySemanticTokensProvider.mockThemeOpacityRawToken) | ||
} | ||
|
||
@Test func inheritedThemeCanOverrideSemanticTokenOpacityWeaker() throws { | ||
#expect(inheritedTheme.opacities.opacityWeaker != abstractTheme.opacities.opacityWeaker) | ||
#expect(inheritedTheme.opacities.opacityWeaker == MockThemeOpacitySemanticTokensProvider.mockThemeOpacityRawToken) | ||
} | ||
|
||
@Test func inheritedThemeCanOverrideSemanticTokenOpacityWeak() throws { | ||
#expect(inheritedTheme.opacities.opacityWeak != abstractTheme.opacities.opacityWeak) | ||
#expect(inheritedTheme.opacities.opacityWeak == MockThemeOpacitySemanticTokensProvider.mockThemeOpacityRawToken) | ||
} | ||
|
||
@Test func inheritedThemeCanOverrideSemanticTokenOpacityMedium() throws { | ||
#expect(inheritedTheme.opacities.opacityMedium != abstractTheme.opacities.opacityMedium) | ||
#expect(inheritedTheme.opacities.opacityMedium == MockThemeOpacitySemanticTokensProvider.mockThemeOpacityRawToken) | ||
} | ||
|
||
@Test func inheritedThemeCanOverrideSemanticTokenOpacityEmphasized() throws { | ||
#expect(inheritedTheme.opacities.opacityStrong != abstractTheme.opacities.opacityStrong) | ||
#expect(inheritedTheme.opacities.opacityStrong == MockThemeOpacitySemanticTokensProvider.mockThemeOpacityRawToken) | ||
} | ||
|
||
@Test func inheritedThemeCanOverrideSemanticTokenOpacityOpaque() throws { | ||
#expect(inheritedTheme.opacities.opacityOpaque != abstractTheme.opacities.opacityOpaque) | ||
#expect(inheritedTheme.opacities.opacityOpaque == MockThemeOpacitySemanticTokensProvider.mockThemeOpacityRawToken) | ||
} | ||
} |