Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  effects.rs

  Sprache: Rust
 

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */


use parsing::parse;
use style::properties::longhands::{perspective_origin, transform_origin};
use style_traits::ToCss;

#[test]
fn test_clip() {
    use style::properties::longhands::clip;

    assert_roundtrip_with_context!(clip::parse, "auto");
    assert_roundtrip_with_context!(clip::parse, "rect(1px, 2px, 3px, 4px)");
    assert_roundtrip_with_context!(clip::parse, "rect(1px, auto, auto, 4px)");
    assert_roundtrip_with_context!(clip::parse, "rect(auto, auto, auto, auto)");

    // Non-standard syntax
    assert_roundtrip_with_context!(
        clip::parse,
        "rect(1px 2px 3px 4px)",
        "rect(1px, 2px, 3px, 4px)"
    );
    assert_roundtrip_with_context!(
        clip::parse,
        "rect(auto 2px 3px auto)",
        "rect(auto, 2px, 3px, auto)"
    );
    assert_roundtrip_with_context!(
        clip::parse,
        "rect(1px auto auto 4px)",
        "rect(1px, auto, auto, 4px)"
    );
    assert_roundtrip_with_context!(
        clip::parse,
        "rect(auto auto auto auto)",
        "rect(auto, auto, auto, auto)"
    );
}

#[test]
fn test_effects_parser_exhaustion() {
    assert_parser_exhausted!(perspective_origin::parse, "1px 1px"true);
    assert_parser_exhausted!(transform_origin::parse, "1px 1px"true);

    assert_parser_exhausted!(perspective_origin::parse, "1px some-rubbish"false);
    assert_parser_exhausted!(transform_origin::parse, "1px some-rubbish"false);
}

#[test]
fn test_parse_factor() {
    use parsing::parse;
    use style::properties::longhands::filter;

    assert!(parse(filter::parse, "brightness(0)").is_ok());
    assert!(parse(filter::parse, "brightness(55)").is_ok());
    assert!(parse(filter::parse, "brightness(100)").is_ok());

    assert!(parse(filter::parse, "contrast(0)").is_ok());
    assert!(parse(filter::parse, "contrast(55)").is_ok());
    assert!(parse(filter::parse, "contrast(100)").is_ok());

    assert!(parse(filter::parse, "grayscale(0)").is_ok());
    assert!(parse(filter::parse, "grayscale(55)").is_ok());
    assert!(parse(filter::parse, "grayscale(100)").is_ok());

    assert!(parse(filter::parse, "invert(0)").is_ok());
    assert!(parse(filter::parse, "invert(55)").is_ok());
    assert!(parse(filter::parse, "invert(100)").is_ok());

    assert!(parse(filter::parse, "opacity(0)").is_ok());
    assert!(parse(filter::parse, "opacity(55)").is_ok());
    assert!(parse(filter::parse, "opacity(100)").is_ok());

    assert!(parse(filter::parse, "sepia(0)").is_ok());
    assert!(parse(filter::parse, "sepia(55)").is_ok());
    assert!(parse(filter::parse, "sepia(100)").is_ok());

    assert!(parse(filter::parse, "saturate(0)").is_ok());
    assert!(parse(filter::parse, "saturate(55)").is_ok());
    assert!(parse(filter::parse, "saturate(100)").is_ok());

    // Negative numbers are invalid for certain filters
    assert!(parse(filter::parse, "brightness(-1)").is_err());
    assert!(parse(filter::parse, "contrast(-1)").is_err());
    assert!(parse(filter::parse, "grayscale(-1)").is_err());
    assert!(parse(filter::parse, "invert(-1)").is_err());
    assert!(parse(filter::parse, "opacity(-1)").is_err());
    assert!(parse(filter::parse, "sepia(-1)").is_err());
    assert!(parse(filter::parse, "saturate(-1)").is_err());
}

#[test]
fn blur_radius_should_not_accept_negavite_values() {
    use style::properties::longhands::box_shadow;
    assert!(parse(box_shadow::parse, "1px 1px -1px").is_err()); // for -ve values
    assert!(parse(box_shadow::parse, "1px 1px 0").is_ok()); // for zero
    assert!(parse(box_shadow::parse, "1px 1px 1px").is_ok()); // for +ve value
}

Messung V0.5 in Prozent
C=97 H=100 G=98

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-06-20) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik