mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-25 20:01:07 +01:00
Asset Export: the scale row's Scale, Suffix and Format share the room the Remove button leaves, as production's rows did
The format rows (Scale, Suffix, Format and Remove) laid out over four Content columns. The Format select is at least a field length wide whatever room its column offers, and Scale took the room the other columns leave at their least, so wherever the grid did not stack the cells, Format and Remove ran past the panel's right edge: at 300 pt, Remove ended at 481 pt. The Save As Preset row under the table then laid out in the widened section and ran past the edge too. Export for Screens draws the same rows.
This commit is contained in:
1 parent
99f7de5262
commit
657bc9418e
2 files changed
+32
-2
No files matched your search
@@ -73,8 +73,9 @@ pub(crate) const SIZES: [&str; 12] = ["0.5x", "0.75x", "1x", "1.5x", "2x", "3x",
|
||||
/// The iOS and Android rows (the engine's `mobile` and `density` presets) and their labels.
|
||||
pub(crate) const PLATFORMS: [(&str, &str); 2] = [("mobile", "iOS"), ("density", "Android")];
|
||||
|
||||
/// The columns of the format rows: scale, suffix, format and the remove button.
|
||||
const COLUMNS: &[ColumnWidth] = &[ColumnWidth::Content; 4];
|
||||
/// The columns of the format rows: scale, suffix and format share the room the remove button leaves. When the
|
||||
/// fields cannot narrow that far, the grid stacks the cells.
|
||||
const COLUMNS: &[ColumnWidth] = &[ColumnWidth::fill(1.0), ColumnWidth::fill(1.0), ColumnWidth::fill(1.0), ColumnWidth::Content];
|
||||
|
||||
/// The text of `key` in `fields`, "" when it has none.
|
||||
fn text<'a>(fields: &'a Map<String, Value>, key: &str) -> &'a str {
|
||||
|
||||
@@ -937,6 +937,35 @@ fn tile_menu_rename_opens_the_clicked_assets_inline_field() {
|
||||
assert_eq!(assets(&mut p.app())[0]["name"], "Renamed");
|
||||
}
|
||||
|
||||
/// In a panel narrower than the scale row's fields at their full length, the row's Scale, Suffix, Format and Remove
|
||||
/// share the panel's width, and the Save As Preset row under them stays inside it too.
|
||||
#[test]
|
||||
fn the_scale_row_fits_the_panel_width() {
|
||||
use craft::ui::contract::Role;
|
||||
for width in [300.0, 440.0] {
|
||||
let (mut app, _, [a, b]) = app(true);
|
||||
app.run("assets.add", json!({"ids": [a, b]})).unwrap();
|
||||
let mut p = panel(app);
|
||||
p.room(egui::vec2(width, 1600.0));
|
||||
p.frame();
|
||||
run(&p, "ui.assetExport.savePresetAs", json!({}));
|
||||
p.frame();
|
||||
let controls = [
|
||||
("Scale", p.rect_role("Scale", Role::COMBO_BOX)),
|
||||
("Suffix", p.rect("Suffix")),
|
||||
("Format", p.rect_role("Format", Role::COMBO_BOX)),
|
||||
("Remove", p.rect("Remove")),
|
||||
("Name:", p.rect_role("Name:", Role::TEXT_INPUT)),
|
||||
("Cancel", p.rect("Cancel")),
|
||||
];
|
||||
// The four controls of the scale row are on one line.
|
||||
assert_eq!(controls[0].1.center().y, controls[3].1.center().y, "one row at {width}");
|
||||
for (name, rect) in controls {
|
||||
assert!(rect.left() >= -0.5 && rect.right() <= width + 0.5, "{name} at {rect:?} is outside a {width} pt panel");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The menu adds the selected artwork as one asset or one per object (an object that is an asset already keeps its
|
||||
/// asset), and is off with no artwork selected.
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user