From 6bd7b78dc3094c6e0affe4076339edab4b849f15 Mon Sep 17 00:00:00 2001 From: Rydmike <39990307+rydmike@users.noreply.github.com> Date: Tue, 27 Aug 2024 03:26:23 +0300 Subject: [PATCH] Update tests for new features --- test/flex_core_palette_test.dart | 75 +++++++++++++++++++++++++++++++ test/flex_seed_scheme_test.dart | 58 ++++++++++++++++++++---- test/flex_tonal_palette_test.dart | 18 +++++++- 3 files changed, 142 insertions(+), 9 deletions(-) diff --git a/test/flex_core_palette_test.dart b/test/flex_core_palette_test.dart index 7703a68..eea7324 100644 --- a/test/flex_core_palette_test.dart +++ b/test/flex_core_palette_test.dart @@ -676,6 +676,9 @@ void main() { FlexTonalPalette.extendedTones[i] != 17 && FlexTonalPalette.extendedTones[i] != 22 && FlexTonalPalette.extendedTones[i] != 24 && + FlexTonalPalette.extendedTones[i] != 65 && + FlexTonalPalette.extendedTones[i] != 75 && + FlexTonalPalette.extendedTones[i] != 84 && FlexTonalPalette.extendedTones[i] != 87 && FlexTonalPalette.extendedTones[i] != 92 && FlexTonalPalette.extendedTones[i] != 94 && @@ -708,6 +711,9 @@ void main() { FlexTonalPalette.extendedTones[i] != 17 && FlexTonalPalette.extendedTones[i] != 22 && FlexTonalPalette.extendedTones[i] != 24 && + FlexTonalPalette.extendedTones[i] != 65 && + FlexTonalPalette.extendedTones[i] != 75 && + FlexTonalPalette.extendedTones[i] != 84 && FlexTonalPalette.extendedTones[i] != 87 && FlexTonalPalette.extendedTones[i] != 92 && FlexTonalPalette.extendedTones[i] != 94 && @@ -739,6 +745,9 @@ void main() { FlexTonalPalette.extendedTones[i] != 17 && FlexTonalPalette.extendedTones[i] != 22 && FlexTonalPalette.extendedTones[i] != 24 && + FlexTonalPalette.extendedTones[i] != 65 && + FlexTonalPalette.extendedTones[i] != 75 && + FlexTonalPalette.extendedTones[i] != 84 && FlexTonalPalette.extendedTones[i] != 87 && FlexTonalPalette.extendedTones[i] != 92 && FlexTonalPalette.extendedTones[i] != 94 && @@ -770,6 +779,9 @@ void main() { FlexTonalPalette.extendedTones[i] != 17 && FlexTonalPalette.extendedTones[i] != 22 && FlexTonalPalette.extendedTones[i] != 24 && + FlexTonalPalette.extendedTones[i] != 65 && + FlexTonalPalette.extendedTones[i] != 75 && + FlexTonalPalette.extendedTones[i] != 84 && FlexTonalPalette.extendedTones[i] != 87 && FlexTonalPalette.extendedTones[i] != 92 && FlexTonalPalette.extendedTones[i] != 94 && @@ -801,6 +813,9 @@ void main() { FlexTonalPalette.extendedTones[i] != 17 && FlexTonalPalette.extendedTones[i] != 22 && FlexTonalPalette.extendedTones[i] != 24 && + FlexTonalPalette.extendedTones[i] != 65 && + FlexTonalPalette.extendedTones[i] != 75 && + FlexTonalPalette.extendedTones[i] != 84 && FlexTonalPalette.extendedTones[i] != 87 && FlexTonalPalette.extendedTones[i] != 92 && FlexTonalPalette.extendedTones[i] != 94 && @@ -832,6 +847,9 @@ void main() { FlexTonalPalette.extendedTones[i] != 17 && FlexTonalPalette.extendedTones[i] != 22 && FlexTonalPalette.extendedTones[i] != 24 && + FlexTonalPalette.extendedTones[i] != 65 && + FlexTonalPalette.extendedTones[i] != 75 && + FlexTonalPalette.extendedTones[i] != 84 && FlexTonalPalette.extendedTones[i] != 87 && FlexTonalPalette.extendedTones[i] != 92 && FlexTonalPalette.extendedTones[i] != 94 && @@ -855,6 +873,7 @@ void main() { tertiaryChroma: 24, paletteType: FlexPaletteType.extended, ); + // print(m3.asList()); test( 'FCP2.07: GIVEN FlexCorePalette.fromSeeds with 3 colors and extended ' 'EXPECT a given list result', () { @@ -874,8 +893,11 @@ void main() { 4284960932, 4286605759, 4288316379, + 4289237225, 4290158072, + 4291013887, 4291804415, + 4292463359, 4292989951, 4293516799, 4293846271, @@ -901,8 +923,11 @@ void main() { 4284636016, 4286280842, 4287991204, + 4288846514, 4289767359, + 4290688461, 4291609307, + 4292333031, 4292925167, 4293451512, 4293846270, @@ -928,8 +953,11 @@ void main() { 4286468704, 4288244345, 4290085778, + 4291006624, 4291993005, + 4292913850, 4293900488, + 4294689747, 4294954459, 4294957539, 4294959592, @@ -955,8 +983,11 @@ void main() { 4284505442, 4286150266, 4287860628, + 4288716193, 4289637038, + 4290557884, 4291478986, + 4292202709, 4292729053, 4293321190, 4293715947, @@ -982,8 +1013,11 @@ void main() { 4284570982, 4286215551, 4287926169, + 4288781478, 4289702324, + 4290557889, 4291478735, + 4292202458, 4292794595, 4293386475, 4293715697, @@ -1009,8 +1043,11 @@ void main() { 4290386458, 4292753200, 4294923337, + 4294930788, 4294936957, + 4294942612, 4294948011, + 4294951868, 4294954953, 4294957782, 4294959838, @@ -1033,6 +1070,7 @@ void main() { tertiaryChroma: null, paletteType: FlexPaletteType.extended, ); + // print(m4.asList()); test( 'FCP2.08: GIVEN FlexCorePalette.fromSeeds with 3 colors and using ' 'chroma from secondary and tertiary and extended palette ' @@ -1055,8 +1093,11 @@ void main() { 4284960932, 4286605759, 4288316379, + 4289237225, 4290158072, + 4291013887, 4291804415, + 4292463359, 4292989951, 4293516799, 4293846271, @@ -1082,8 +1123,11 @@ void main() { 4284636017, 4286280586, 4287991205, + 4288846514, 4289767360, + 4290688462, 4291609308, + 4292333031, 4292925168, 4293451513, 4293846270, @@ -1109,8 +1153,11 @@ void main() { 4286403168, 4288178809, 4290020242, + 4291006623, 4291927469, + 4292913850, 4293834952, + 4294624211, 4294954459, 4294957539, 4294959592, @@ -1136,8 +1183,11 @@ void main() { 4284505442, 4286150266, 4287860628, + 4288716193, 4289637038, + 4290557884, 4291478986, + 4292202709, 4292729053, 4293321190, 4293715947, @@ -1163,8 +1213,11 @@ void main() { 4284570982, 4286215551, 4287926169, + 4288781478, 4289702324, + 4290557889, 4291478735, + 4292202458, 4292794595, 4293386475, 4293715697, @@ -1190,8 +1243,11 @@ void main() { 4290386458, 4292753200, 4294923337, + 4294930788, 4294936957, + 4294942612, 4294948011, + 4294951868, 4294954953, 4294957782, 4294959838, @@ -1285,6 +1341,7 @@ void main() { 'FCP1.U07: GIVEN a FlexCorePalette from a extended List ' 'EXPECT it to be equal to one created from same seed Based ' 'extended one', () { + // print(m3.asList()); expect( m3, equals( @@ -1304,8 +1361,11 @@ void main() { 4284960932, 4286605759, 4288316379, + 4289237225, 4290158072, + 4291013887, 4291804415, + 4292463359, 4292989951, 4293516799, 4293846271, @@ -1331,8 +1391,11 @@ void main() { 4284636016, 4286280842, 4287991204, + 4288846514, 4289767359, + 4290688461, 4291609307, + 4292333031, 4292925167, 4293451512, 4293846270, @@ -1358,8 +1421,11 @@ void main() { 4286468704, 4288244345, 4290085778, + 4291006624, 4291993005, + 4292913850, 4293900488, + 4294689747, 4294954459, 4294957539, 4294959592, @@ -1385,8 +1451,11 @@ void main() { 4284505442, 4286150266, 4287860628, + 4288716193, 4289637038, + 4290557884, 4291478986, + 4292202709, 4292729053, 4293321190, 4293715947, @@ -1412,8 +1481,11 @@ void main() { 4284570982, 4286215551, 4287926169, + 4288781478, 4289702324, + 4290557889, 4291478735, + 4292202458, 4292794595, 4293386475, 4293715697, @@ -1439,8 +1511,11 @@ void main() { 4290386458, 4292753200, 4294923337, + 4294930788, 4294936957, + 4294942612, 4294948011, + 4294951868, 4294954953, 4294957782, 4294959838, diff --git a/test/flex_seed_scheme_test.dart b/test/flex_seed_scheme_test.dart index aeecf1f..fe46845 100644 --- a/test/flex_seed_scheme_test.dart +++ b/test/flex_seed_scheme_test.dart @@ -894,6 +894,48 @@ void main() { expect(scheme, scheme2); }); + test( + 'FCS7.014-fixedColor-l: GIVEN a SeedColorScheme.fromSeeds using ' + 'five seeds and tones map FlexTones.material for a light scheme with ' + 'error neutral and variant chroma set but with modified fixed ' + 'tones and variant tones ' + 'EXPECT scheme equal to using higherContrastFixed()', () { + final ColorScheme scheme = SeedColorScheme.fromSeeds( + brightness: Brightness.light, + primaryKey: primarySeedColor, + secondaryKey: secondarySeedColor, + tertiaryKey: tertiarySeedColor, + neutralKey: neutralSeedColor, + neutralVariantKey: neutralVariantSeedColor, + tones: FlexTones.material(Brightness.light).copyWith( + primaryFixedTone: 92, + primaryFixedDimTone: 84, + onPrimaryFixedTone: 6, + onPrimaryFixedVariantTone: 12, + // + secondaryFixedTone: 92, + secondaryFixedDimTone: 84, + onSecondaryFixedTone: 6, + onSecondaryFixedVariantTone: 12, + // + tertiaryFixedTone: 92, + tertiaryFixedDimTone: 84, + onTertiaryFixedTone: 6, + onTertiaryFixedVariantTone: 12, + ), + ); + final ColorScheme scheme2 = SeedColorScheme.fromSeeds( + brightness: Brightness.light, + primaryKey: primarySeedColor, + secondaryKey: secondarySeedColor, + tertiaryKey: tertiarySeedColor, + neutralKey: neutralSeedColor, + neutralVariantKey: neutralVariantSeedColor, + tones: FlexTones.material(Brightness.light).higherContrastFixed(), + ); + expect(scheme, scheme2); + }); + test( 'FCS7.015-l: GIVEN a SeedColorScheme.fromSeeds using six seeds ' 'and variant tonalSpot for a light scheme ' @@ -1011,7 +1053,7 @@ void main() { test( 'FCS7.017-l: GIVEN a SeedColorScheme.fromSeeds using six seeds ' 'and variant content for a light scheme ' - 'EXPECT some given checked color result', () { + 'EXPECT this given checked color result', () { final ColorScheme scheme = SeedColorScheme.fromSeeds( brightness: Brightness.light, primaryKey: primarySeedColor, @@ -1036,7 +1078,7 @@ void main() { test( 'FCS7.018-l: GIVEN a SeedColorScheme.fromSeeds using six seeds ' 'and variant expressive for a light scheme ' - 'EXPECT some given checked color result', () { + 'EXPECT this given checked color result', () { final ColorScheme scheme = SeedColorScheme.fromSeeds( brightness: Brightness.light, primaryKey: primarySeedColor, @@ -1061,7 +1103,7 @@ void main() { test( 'FCS7.019-l: GIVEN a SeedColorScheme.fromSeeds using six seeds ' 'and variant fidelity for a light scheme ' - 'EXPECT some given checked color result', () { + 'EXPECT this given checked color result', () { final ColorScheme scheme = SeedColorScheme.fromSeeds( brightness: Brightness.light, primaryKey: primarySeedColor, @@ -1086,7 +1128,7 @@ void main() { test( 'FCS7.020-l: GIVEN a SeedColorScheme.fromSeeds using six seeds ' 'and fruitSalad content for a light scheme ' - 'EXPECT some given checked color result', () { + 'EXPECT this given checked color result', () { final ColorScheme scheme = SeedColorScheme.fromSeeds( brightness: Brightness.light, primaryKey: primarySeedColor, @@ -1111,7 +1153,7 @@ void main() { test( 'FCS7.021-l: GIVEN a SeedColorScheme.fromSeeds using six seeds ' 'and monochrome content for a light scheme ' - 'EXPECT some given checked color result', () { + 'EXPECT this given checked color result', () { final ColorScheme scheme = SeedColorScheme.fromSeeds( brightness: Brightness.light, primaryKey: primarySeedColor, @@ -1136,7 +1178,7 @@ void main() { test( 'FCS7.022-l: GIVEN a SeedColorScheme.fromSeeds using six seeds ' 'and neutral content for a light scheme ' - 'EXPECT some given checked color result', () { + 'EXPECT this given checked color result', () { final ColorScheme scheme = SeedColorScheme.fromSeeds( brightness: Brightness.light, primaryKey: primarySeedColor, @@ -1161,7 +1203,7 @@ void main() { test( 'FCS7.023-l: GIVEN a SeedColorScheme.fromSeeds using six seeds ' 'and rainbow content for a light scheme ' - 'EXPECT some given checked color result', () { + 'EXPECT this given checked color result', () { final ColorScheme scheme = SeedColorScheme.fromSeeds( brightness: Brightness.light, primaryKey: primarySeedColor, @@ -1186,7 +1228,7 @@ void main() { test( 'FCS7.024-l: GIVEN a SeedColorScheme.fromSeeds using six seeds ' 'and vibrant content for a light scheme ' - 'EXPECT some given checked color result', () { + 'EXPECT this given checked color result', () { final ColorScheme scheme = SeedColorScheme.fromSeeds( brightness: Brightness.light, primaryKey: primarySeedColor, diff --git a/test/flex_tonal_palette_test.dart b/test/flex_tonal_palette_test.dart index 968981b..a170fd9 100644 --- a/test/flex_tonal_palette_test.dart +++ b/test/flex_tonal_palette_test.dart @@ -249,6 +249,7 @@ void main() { FlexTonalPalette.of(40, 55, FlexPaletteType.extended); // m3, is tonal palettes using TonalPalette. final TonalPalette m3 = TonalPalette.of(40, 55); + // print(m1.asList); // m4, is tonal palette from list final FlexTonalPalette m4 = FlexTonalPalette.fromList(const [ 4278190080, @@ -266,8 +267,11 @@ void main() { 4288692500, 4290795563, 4292964674, + 4294016333, 4294937692, + 4294943100, 4294948249, + 4294952367, 4294955198, 4294958030, 4294959832, @@ -296,8 +300,11 @@ void main() { 4288692500, 4290795563, 4292964674, + 4294016333, 4294937692, + 4294943100, 4294948249, + 4294952367, 4294955198, 4294958030, 4294959832, @@ -390,6 +397,9 @@ void main() { FlexTonalPalette.extendedTones[i] != 17 && FlexTonalPalette.extendedTones[i] != 22 && FlexTonalPalette.extendedTones[i] != 24 && + FlexTonalPalette.extendedTones[i] != 65 && + FlexTonalPalette.extendedTones[i] != 75 && + FlexTonalPalette.extendedTones[i] != 84 && FlexTonalPalette.extendedTones[i] != 87 && FlexTonalPalette.extendedTones[i] != 92 && FlexTonalPalette.extendedTones[i] != 94 && @@ -422,7 +432,7 @@ void main() { m4.toString(), equals( // ignore: lines_longer_than_80_chars - 'FlexTonalPalette.fromList([4278190080, 4279567104, 4280354304, 4280616704, 4280879360, 4281798144, 4282257664, 4283373568, 4284095488, 4284555008, 4285014528, 4286524160, 4288692500, 4290795563, 4292964674, 4294937692, 4294948249, 4294955198, 4294958030, 4294959832, 4294961634, 4294962663, 4294963692, 4294964465, 4294965494, 4294966271, 4294967295], FlexPaletteType.extended)'), + 'FlexTonalPalette.fromList([4278190080, 4279567104, 4280354304, 4280616704, 4280879360, 4281798144, 4282257664, 4283373568, 4284095488, 4284555008, 4285014528, 4286524160, 4288692500, 4290795563, 4292964674, 4294016333, 4294937692, 4294943100, 4294948249, 4294952367, 4294955198, 4294958030, 4294959832, 4294961634, 4294962663, 4294963692, 4294964465, 4294965494, 4294966271, 4294967295], FlexPaletteType.extended)'), ); }); test( @@ -444,8 +454,11 @@ void main() { 4288692500, 4290795563, 4292964674, + 4294016333, 4294937692, + 4294943100, 4294948249, + 4294952367, 4294955198, 4294958030, 4294959832, @@ -483,8 +496,11 @@ void main() { 4288692500, 4290795563, 4292964674, + 4294016333, 4294937692, + 4294943100, 4294948249, + 4294952367, 4294955198, 4294958030, 4294959832,