Commit 35400e5c authored by RazrFalcon's avatar RazrFalcon

Remove rendersvg tests, because they are useless.

parent f869da14
See [docs/build.md](../docs/build.md) first.
Note: we are using *qt-backend* just for example.
### custom.rs
Render image using a manually constructed SVG render tree.
```bash
cargo run --features "qt-backend" --example custom_rtree
```
### draw_bboxes.rs
Draw bounding boxes aroung all shapes on input SVG.
```bash
cargo run --features "qt-backend" --example draw_bboxes -- bboxes.svg bboxes.png -z 4
```
### minimal.rs
A simple SVG to PNG converter.
```bash
cargo run --features "qt-backend" --example minimal -- in.svg out.png
```
......@@ -8,7 +8,7 @@ I'm not good with C and GTK+ so any suggestions are welcome.
# build C-API with a cairo backend first
cargo build --release --features "cairo-backend" --manifest-path ../../capi/Cargo.toml
make
LD_LIBRARY_PATH=../../target/debug ./example ../qt-demo/svg-logo.svg
LD_LIBRARY_PATH=../../target/debug ./example ../qt-demo/hello-resvg.svg
```
See [docs/build.md](../../docs/build.md) for details.
......@@ -3,7 +3,7 @@ A simple example that shows how to use *resvg* from `gtk-rs`.
## Run
```bash
cargo run -- ../qt-demo/svg-logo.svg
cargo run -- ../qt-demo/hello-resvg.svg
```
See [docs/build.md](../../docs/build.md) for details.
......@@ -105,15 +105,6 @@ run(['cargo', 'test', '--features', 'cairo-backend'], check=True)
run(['cargo', 'test', '--features', 'qt-backend'], check=True)
# rendersvg unit tests
#
# run only locally, because bboxes depend on freetype settings
if local_test:
with cd('tools/rendersvg'):
run(['cargo', 'test', '--features', 'qt-backend'], check=True)
run(['cargo', 'test', '--features', 'cairo-backend'], check=True)
if 'RESVG_QT_BACKEND' in os.environ:
# test Qt C-API
#
......
......@@ -16,7 +16,3 @@ time = "0.1"
[features]
cairo-backend = ["resvg/cairo-backend"]
qt-backend = ["resvg/qt-backend"]
[dev-dependencies]
assert_cli = "0.5"
indoc = "0.2"
extern crate assert_cli;
#[macro_use]
extern crate indoc;
use assert_cli::Assert;
const APP_PATH: &str = "../../target/debug/rendersvg";
#[test]
fn query_all() {
let args = &[
APP_PATH,
"--query-all",
"tests/images/bbox.svg",
];
#[cfg(feature = "cairo-backend")]
let output = indoc!("
rect1,10,20,100,50
rect2,7.5,92.5,105,55
rect3,7.983,170,128.868,50
rect4,7.182,242.5,133.868,55
rect5,9.584,329.203,70.711,70.711
long_text,10.281,441.953,550.594,10.047
text1,200.703,23,53.406,22
text2,200.875,102,32.172,28
text3,202.311,178,55.692,22
text4,195.703,243,63.406,32
text5,206.739,306.299,58.393,26.092
g1,350,20,100,50
g2,350,95,120,70
");
#[cfg(feature = "qt-backend")]
let output = indoc!("
rect1,10,20,100,50
rect2,7.5,92.5,105,55
rect3,7.983,170,128.868,50
rect4,7.182,242.5,133.868,55
rect5,9.584,329.203,70.711,70.711
long_text,10.281,441.25,550.203,11.281
text1,200.703,23.531,54.063,21.828
text2,200.875,101.375,31.172,28.766
text3,202.311,178.531,56.068,21.828
text4,195.703,243.531,64.063,31.828
text5,206.739,306.759,58.136,25.632
g1,350,20,100,50
g2,350,95,120,70
");
Assert::command(args)
.stdout().is(output)
.stderr().is("")
.unwrap();
}
// Check that all warnings are skipped during the ID querying.
// Some crates still can print to stdout/stderr, but we can't do anything about it.
#[test]
fn query_file_with_warnings() {
let args = &[
APP_PATH,
"--query-all",
"tests/images/bbox_with_warnings.svg",
];
let output = indoc!("
rect1,10,20,100,50
");
Assert::command(args)
.stdout().is(output)
.stderr().is("")
.unwrap();
}
#[test]
fn query_file_without_ids() {
let args = &[
APP_PATH,
"--query-all",
"tests/images/bbox_without_ids.svg",
];
Assert::command(args)
.fails()
.stdout().is("")
.stderr().is("Error: the file has no valid ID's.")
.unwrap();
}
<svg width="500" height="500" xmlns="http://www.w3.org/2000/svg" font-family="Arial" font-size="12">
<rect id="rect1" x="10" y="20" width="100" height="50" fill="black" style="-webkit:value"/>
</svg>
<svg width="500" height="500" xmlns="http://www.w3.org/2000/svg">
<rect x="10" y="20" width="100" height="50" fill="black"/>
</svg>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment