Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
207 changes: 161 additions & 46 deletions crates/labcolors-core/src/appearance.rs

Large diffs are not rendered by default.

220 changes: 152 additions & 68 deletions crates/labcolors-core/src/appearance_graph_tests.rs

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions crates/labcolors-core/src/constraint_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use proptest::prelude::*;
use crate::appearance::{
AppearanceBindings, AppearanceGraphSpec, ColorInputId, CompositionProfileV1, OccurrenceId,
OccurrenceSpec, OpacityInputId, PaintId, PaintSpec, PointOpacityOverSurfaceV1, SurfaceId,
SurfaceSpec,
SurfaceInputPortId, SurfaceSpec,
};
use crate::constraints::{BoundAssessment, Wcag22Srgb8V1, assess};
use crate::wcag22::{
Expand Down Expand Up @@ -107,7 +107,7 @@ fn modeled_target_has_no_binding_or_source_capability() {

fn two_equal_physical_occurrences() -> [crate::appearance::ResolvedOccurrence; 2] {
let source = ColorInputId::new(0);
let backdrop = ColorInputId::new(1);
let backdrop = SurfaceInputPortId::new(1);
let opacity = OpacityInputId::new(0);
let solid = PaintId::new(0);
let translucent = PaintId::new(1);
Expand All @@ -117,7 +117,8 @@ fn two_equal_physical_occurrences() -> [crate::appearance::ResolvedOccurrence; 2
let first = OccurrenceId::new(0);
let second = OccurrenceId::new(1);
let graph = AppearanceGraphSpec::new(
vec![source, backdrop],
vec![source],
vec![backdrop],
vec![opacity],
vec![
PaintSpec::Solid {
Expand All @@ -133,7 +134,7 @@ fn two_equal_physical_occurrences() -> [crate::appearance::ResolvedOccurrence; 2
vec![
SurfaceSpec::Input {
id: backdrop_surface,
color: backdrop,
port: backdrop,
},
SurfaceSpec::FromOccurrence {
id: first_surface,
Expand Down Expand Up @@ -163,7 +164,8 @@ fn two_equal_physical_occurrences() -> [crate::appearance::ResolvedOccurrence; 2
.expect("acyclic typed graph must compile");
let evaluation = graph
.evaluate(&AppearanceBindings::new(
vec![(source, [0, 64, 255]), (backdrop, [255, 255, 255])],
vec![(source, crate::Srgb8::new([0, 64, 255]))],
vec![(backdrop, crate::Srgb8::new([255, 255, 255]))],
vec![(opacity, 0.5)],
))
.expect("complete bindings must evaluate");
Expand Down
6 changes: 6 additions & 0 deletions crates/labcolors-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ mod agnostic_gates;
#[cfg(test)]
mod appearance_graph_tests;

#[cfg(test)]
pub(crate) mod observation;

#[cfg(test)]
mod observation_tests;

#[cfg(test)]
mod constraint_tests;

Expand Down
Loading
Loading