test for hue when largest channel is blue

This commit is contained in:
Connor Skees 2021-07-21 22:07:03 -04:00
parent 9ed2a8a984
commit fba42df43b
2 changed files with 10 additions and 4 deletions

View File

@ -47,6 +47,7 @@ impl MediaQuery {
}
}
#[allow(clippy::if_not_else)]
fn merge(&self, other: &Self) -> MediaQueryMergeResult {
let this_modifier = self.modifier.as_ref().map(|m| m.to_ascii_lowercase());
let this_type = self.media_type.as_ref().map(|m| m.to_ascii_lowercase());
@ -91,12 +92,12 @@ impl MediaQuery {
if negative_features
.iter()
.all(|feat| positive_features.contains(&feat))
.all(|feat| positive_features.contains(feat))
{
return MediaQueryMergeResult::Empty;
} else {
return MediaQueryMergeResult::Unrepresentable;
}
return MediaQueryMergeResult::Unrepresentable;
} else if self.matches_all_types() || other.matches_all_types() {
return MediaQueryMergeResult::Unrepresentable;
}
@ -173,7 +174,7 @@ impl MediaQuery {
return MediaQueryMergeResult::Empty;
} else {
if this_modifier.is_some() {
modifier = &this_modifier
modifier = &this_modifier;
} else {
modifier = &other_modifier;
}

View File

@ -788,3 +788,8 @@ test!(
"a {\n color: mix(rgba(255, 20, 0, 0), rgba(0, 20, 255, 1), 100);\n}\n",
"a {\n color: rgba(255, 20, 0, 0);\n}\n"
);
test!(
hue_largest_channel_is_blue,
"a {\n color: hue(rgb(1, 2, 5));\n}\n",
"a {\n color: 225deg;\n}\n"
);