Fixed all do commands.
This commit is contained in:
parent
f162015ff7
commit
018853ab04
|
@ -1,6 +1,4 @@
|
|||
* Test animations in two windows, it is causing some panics.
|
||||
thread 'main' panicked at 'assertion failed: !self.view_is_rendering()'
|
||||
* Adjust when respawn stops happening, it can enter an infinite loop in panics like the large image.
|
||||
* Build tests harness does not build. (error is this: https://github.com/rust-lang/cargo/issues/6915)
|
||||
restructure project using crates for tests and examples
|
||||
* When reopening an image (like the panorama one in the image example) it doesn't load.
|
||||
|
|
|
@ -8,6 +8,10 @@ edition = "2021"
|
|||
trybuild = "1"
|
||||
zero-ui = { path = "../../zero-ui" }
|
||||
|
||||
[lib]
|
||||
name = "lib"
|
||||
path = "run.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "main"
|
||||
path = "main.rs"
|
|
@ -2,18 +2,8 @@
|
|||
//!
|
||||
//! Use `cargo do test -b property/*` to run all paths that match in the `./cases` folder.
|
||||
|
||||
mod run;
|
||||
|
||||
fn main() {
|
||||
if let Some(test) = std::env::var_os("DO_TASKS_TEST_BUILD") {
|
||||
let mut test = test.to_string_lossy();
|
||||
|
||||
if ["*", "**"].contains(&test.as_ref()) {
|
||||
test = "*/*".into();
|
||||
}
|
||||
|
||||
std::env::set_current_dir(format!("{}/cases", env!("CARGO_MANIFEST_DIR"))).unwrap();
|
||||
|
||||
trybuild::TestCases::new().compile_fail(format!("{}.rs", test));
|
||||
} else {
|
||||
eprintln!("run with `cargo do test --build *`");
|
||||
}
|
||||
run::do_request();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
pub fn do_request() {
|
||||
if let Some(test) = std::env::var_os("DO_TASKS_TEST_BUILD") {
|
||||
let mut test = test.to_string_lossy();
|
||||
|
||||
if ["*", "**"].contains(&test.as_ref()) {
|
||||
test = "*/*".into();
|
||||
}
|
||||
|
||||
std::env::set_current_dir(env!("CARGO_MANIFEST_DIR")).unwrap();
|
||||
|
||||
trybuild::TestCases::new().compile_fail(format!("cases/{}.rs", test));
|
||||
} else {
|
||||
eprintln!("run with `cargo do test --build *`");
|
||||
}
|
||||
}
|
|
@ -241,10 +241,8 @@ fn run(mut args: Vec<&str>) {
|
|||
// FLAGS:
|
||||
// --dump Write the expanded Rust code to "dump.rs".
|
||||
// USAGE:
|
||||
// expand some::item
|
||||
// Prints only the specified item in the main crate.
|
||||
// expand -p "other-crate" some::item
|
||||
// Prints only the specified item in the other-crate from workspace.
|
||||
// expand -p crate-name item::path
|
||||
// Prints only the specified item in the crate from workspace.
|
||||
// expand -e "example"
|
||||
// Prints the example.
|
||||
// expand --raw
|
||||
|
@ -261,6 +259,7 @@ fn expand(mut args: Vec<&str>) {
|
|||
test_args.insert(0, "+nightly");
|
||||
test(test_args);
|
||||
|
||||
|
||||
TaskInfo::get().stdout_dump = "dump.rs";
|
||||
for (bin_name, path) in build_test_cases() {
|
||||
let i = path.find("tests").unwrap_or_default();
|
||||
|
@ -270,7 +269,7 @@ fn expand(mut args: Vec<&str>) {
|
|||
&[
|
||||
"expand",
|
||||
"--manifest-path",
|
||||
"target/tests/zero-ui/Cargo.toml",
|
||||
"target/tests/build-tests/Cargo.toml",
|
||||
"--bin",
|
||||
&bin_name,
|
||||
"--all-features",
|
||||
|
@ -283,10 +282,14 @@ fn expand(mut args: Vec<&str>) {
|
|||
cmd("cargo", &["expand", "--package", "examples", "--example"], &args);
|
||||
} else {
|
||||
TaskInfo::get().stdout_dump = "dump.rs";
|
||||
if take_flag(&mut args, &["-r", "--raw"]) {
|
||||
if !args.contains(&"-p") && !args.contains(&"--package") {
|
||||
error("expected crate name");
|
||||
} else if take_flag(&mut args, &["-r", "--raw"]) {
|
||||
let p = take_option(&mut args, &["-p", "--package"], "<crate-name>").unwrap();
|
||||
|
||||
cmd(
|
||||
"cargo",
|
||||
&["+nightly", "rustc", "--profile=check", "--", "-Zunpretty=expanded"],
|
||||
&["+nightly", "rustc", "--profile=check", "--package", p[0], "--", "-Zunpretty=expanded"],
|
||||
&args,
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -239,7 +239,7 @@ pub fn examples() -> Vec<String> {
|
|||
|
||||
// [[bin]] names for build tests last run ("bin-name", "test_file_path").
|
||||
pub fn build_test_cases() -> Vec<(String, String)> {
|
||||
match std::fs::read_to_string("target/tests/zero-ui/Cargo.toml") {
|
||||
match std::fs::read_to_string("target/tests/build-tests/Cargo.toml") {
|
||||
Ok(file) => {
|
||||
let mut bin_names = vec![];
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ pub mod grid {
|
|||
let column_widths: Vec<_> = self.columns.iter_mut().map(|c| c.measure(ctx, c_available_size)).collect();
|
||||
let row_heights: Vec<_> = self.rows.iter_mut().map(|r| r.measure(ctx, r_available_size)).collect();
|
||||
|
||||
let mut desired_size = PxSize::zero();
|
||||
let desired_size = PxSize::zero();
|
||||
let mut c_desired_widths = vec![Px(0); column_widths.len()];
|
||||
let mut r_desired_heights = vec![Px(0); row_heights.len()];
|
||||
|
||||
|
@ -275,7 +275,7 @@ pub mod grid {
|
|||
}
|
||||
|
||||
fn arrange(&mut self, ctx: &mut LayoutContext, widget_offset: &mut WidgetOffset, final_size: PxSize) {
|
||||
let _ = (ctx, final_size);
|
||||
let _ = (ctx, widget_offset, final_size);
|
||||
todo!()
|
||||
}
|
||||
|
||||
|
|
|
@ -366,7 +366,7 @@ pub mod scrollable {
|
|||
fn scrollbar_presenter(var: impl IntoVar<ViewGenerator<ScrollBarArgs>>, orientation: scrollbar::Orientation) -> impl UiNode {
|
||||
ViewGenerator::presenter(
|
||||
var,
|
||||
|vars, widget| {
|
||||
|_vars, _widget| {
|
||||
// TODO
|
||||
},
|
||||
move |ctx, is_new| {
|
||||
|
|
Loading…
Reference in New Issue