mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
auto merge of #1672 : kmcallister/servo/tests, r=pcwalton
I'd like to have an `iframe` reftest as well but `iframe`s are currently broken. Will look into that next.
This commit is contained in:
commit
31e36b7bd7
10 changed files with 46 additions and 13 deletions
|
@ -62,6 +62,8 @@ pub use servo_util::url::parse_url;
|
|||
|
||||
#[cfg(not(test))]
|
||||
use std::os;
|
||||
#[cfg(not(test))]
|
||||
use extra::url::Url;
|
||||
#[cfg(not(test), target_os="android")]
|
||||
use std::str;
|
||||
#[cfg(not(test))]
|
||||
|
@ -166,7 +168,16 @@ fn run(opts: Opts) {
|
|||
|
||||
// Send the URL command to the constellation.
|
||||
for filename in opts.urls.iter() {
|
||||
constellation_chan.send(InitLoadUrlMsg(parse_url(*filename, None)))
|
||||
let url = if filename.starts_with("data:") {
|
||||
// As a hack for easier command-line testing,
|
||||
// assume that data URLs are not URL-encoded.
|
||||
Url::new(~"data", None, ~"", None,
|
||||
filename.slice_from(5).to_owned(), ~[], None)
|
||||
} else {
|
||||
parse_url(*filename, None)
|
||||
};
|
||||
|
||||
constellation_chan.send(InitLoadUrlMsg(url));
|
||||
}
|
||||
|
||||
// Send the constallation Chan as the result
|
||||
|
|
|
@ -56,10 +56,10 @@ pub fn parse_url(str_url: &str, base_url: Option<Url>) -> Url {
|
|||
}
|
||||
},
|
||||
Ok((scheme, page)) => {
|
||||
match scheme {
|
||||
~"about" => {
|
||||
match page {
|
||||
~"failure" => {
|
||||
match scheme.as_slice() {
|
||||
"about" => {
|
||||
match page.as_slice() {
|
||||
"failure" => {
|
||||
let mut path = os::getcwd();
|
||||
path.push("../src/test/html/failure.html");
|
||||
// FIXME (#1094): not the right way to transform a path
|
||||
|
@ -69,7 +69,7 @@ pub fn parse_url(str_url: &str, base_url: Option<Url>) -> Url {
|
|||
_ => str_url
|
||||
}
|
||||
},
|
||||
~"data" => {
|
||||
"data" => {
|
||||
// Drop whitespace within data: URLs, e.g. newlines within a base64
|
||||
// src="..." block. Whitespace intended as content should be
|
||||
// %-encoded or base64'd.
|
||||
|
@ -81,7 +81,7 @@ pub fn parse_url(str_url: &str, base_url: Option<Url>) -> Url {
|
|||
};
|
||||
|
||||
// FIXME: Need to handle errors
|
||||
url::from_str(str_url).unwrap()
|
||||
url::from_str(str_url).ok().expect("URL parsing failed")
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
7
src/test/html/simple_iframe.html
Normal file
7
src/test/html/simple_iframe.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<html>
|
||||
<body>
|
||||
<iframe src="simple_iframe_inner.html"
|
||||
style="display:block; border: 1px; width: 400px; height: 400px">
|
||||
</iframe>
|
||||
</body>
|
||||
</html>
|
5
src/test/html/simple_iframe_inner.html
Normal file
5
src/test/html/simple_iframe_inner.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<html>
|
||||
<body>
|
||||
Just a simple little iframe.
|
||||
</body>
|
||||
</html>
|
|
@ -28,3 +28,4 @@
|
|||
== anon_block_inherit_a.html anon_block_inherit_b.html
|
||||
== position_relative_a.html position_relative_b.html
|
||||
== attr_exists_selector.html attr_exists_selector_ref.html
|
||||
== data_img_a.html data_img_b.html
|
||||
|
|
9
src/test/ref/data_img_b.html
Normal file
9
src/test/ref/data_img_b.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<img src="rust_logo.png" />
|
||||
</body>
|
||||
</html>
|
|
@ -6,13 +6,13 @@
|
|||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<img src="img_size.png" width="206" />
|
||||
<img src="rust_logo.png" width="206" />
|
||||
</div>
|
||||
<div>
|
||||
<img src="img_size.png" width="206" />
|
||||
<img src="rust_logo.png" width="206" />
|
||||
</div>
|
||||
<div style="width:1000px">
|
||||
<img src="img_size.png" style="width:100px" />
|
||||
<img src="rust_logo.png" style="width:100px" />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<img src="img_size.png" height="206" />
|
||||
<img src="rust_logo.png" height="206" />
|
||||
</div>
|
||||
<div>
|
||||
<img src="img_size.png" style="height:206px"/>
|
||||
<img src="rust_logo.png" style="height:206px"/>
|
||||
</div>
|
||||
<div style="width:1000px">
|
||||
<img src="img_size.png" style="width:10%" />
|
||||
<img src="rust_logo.png" style="width:10%" />
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Loading…
Add table
Add a link
Reference in a new issue