[librsvg: 4/5] (#699) - Add tests for MIME type conversions for gdk-pixbuf




commit 865945c8258070e2dbd9d1789f6e51c947f45633
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Mar 17 13:06:32 2021 -0600

    (#699) - Add tests for MIME type conversions for gdk-pixbuf
    
    This is the end of the fix for #699.
    
    Fixes https://gitlab.gnome.org/GNOME/librsvg/-/issues/699

 src/document.rs | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/src/document.rs b/src/document.rs
index b6612e87..bce51a77 100644
--- a/src/document.rs
+++ b/src/document.rs
@@ -590,4 +590,21 @@ mod tests {
             Err(NodeIdError::NodeIdRequired)
         ));
     }
+
+    #[test]
+    fn unspecified_mime_type_yields_no_content_type() {
+        // Issue #548
+        let mime = Mime::from_str("text/plain;charset=US-ASCII").unwrap();
+        assert!(content_type_for_gdk_pixbuf(&mime).is_none());
+    }
+
+    #[test]
+    fn strips_mime_type_parameters() {
+        // Issue #699
+        let mime = Mime::from_str("image/png;charset=utf-8").unwrap();
+        assert_eq!(
+            content_type_for_gdk_pixbuf(&mime),
+            Some(String::from("image/png"))
+        );
+    }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]