mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-28 03:37:00 -06:00
refactor(engine): move tests_*.rs to tests/<topic>.rs
This commit is contained in:
+2
-336
@@ -2596,344 +2596,10 @@ pub(crate) fn adding_fonts() -> std::sync::MutexGuard<'static, ()> {
|
||||
FONTS.lock().unwrap_or_else(std::sync::PoisonError::into_inner)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
use tests::{adjust as tests_adjust, clip as tests_clip, colormgmt as tests_colormgmt, expand as tests_expand, large_edits as tests_large_edits, links as tests_links, linkspanel as tests_linkspanel, menucmds as tests_menucmds, outlinestroke as tests_outlinestroke, persp_select as tests_persp_select, textimport as tests_textimport};
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
#[cfg(test)]
|
||||
mod tests_adjust;
|
||||
#[cfg(test)]
|
||||
mod tests_appearance;
|
||||
#[cfg(test)]
|
||||
mod tests_areafit;
|
||||
#[cfg(test)]
|
||||
mod tests_assets;
|
||||
#[cfg(test)]
|
||||
mod tests_attributes;
|
||||
#[cfg(test)]
|
||||
mod tests_bboxrotate;
|
||||
#[cfg(test)]
|
||||
mod tests_blendfidelity;
|
||||
#[cfg(test)]
|
||||
mod tests_blendopts;
|
||||
#[cfg(test)]
|
||||
mod tests_blendspine;
|
||||
#[cfg(test)]
|
||||
mod tests_brushlib;
|
||||
#[cfg(test)]
|
||||
mod tests_brushsym;
|
||||
#[cfg(test)]
|
||||
mod tests_build;
|
||||
#[cfg(test)]
|
||||
mod tests_cancel;
|
||||
#[cfg(test)]
|
||||
mod tests_charstroke;
|
||||
#[cfg(test)]
|
||||
mod tests_clip;
|
||||
#[cfg(test)]
|
||||
mod tests_clipboard;
|
||||
#[cfg(test)]
|
||||
mod tests_clipflavours;
|
||||
#[cfg(test)]
|
||||
mod tests_clippaint;
|
||||
#[cfg(test)]
|
||||
mod tests_cmdsplit;
|
||||
#[cfg(test)]
|
||||
mod tests_cmykflatten;
|
||||
#[cfg(test)]
|
||||
mod tests_colorguide;
|
||||
#[cfg(test)]
|
||||
mod tests_colorguidelib;
|
||||
#[cfg(test)]
|
||||
mod tests_colormgmt;
|
||||
#[cfg(test)]
|
||||
mod tests_colorthemes;
|
||||
#[cfg(test)]
|
||||
mod tests_colourfonts;
|
||||
#[cfg(test)]
|
||||
mod tests_compoundpaint;
|
||||
#[cfg(test)]
|
||||
mod tests_constrain_new;
|
||||
#[cfg(test)]
|
||||
mod tests_constrain_tools;
|
||||
#[cfg(test)]
|
||||
mod tests_containers;
|
||||
#[cfg(test)]
|
||||
mod tests_css;
|
||||
#[cfg(test)]
|
||||
mod tests_cut;
|
||||
#[cfg(test)]
|
||||
mod tests_dashalign;
|
||||
#[cfg(test)]
|
||||
mod tests_distort;
|
||||
#[cfg(test)]
|
||||
mod tests_docsetup;
|
||||
#[cfg(test)]
|
||||
mod tests_draw2;
|
||||
#[cfg(test)]
|
||||
mod tests_editcolors;
|
||||
#[cfg(test)]
|
||||
mod tests_effectedit;
|
||||
#[cfg(test)]
|
||||
mod tests_emptytype;
|
||||
#[cfg(test)]
|
||||
mod tests_envelope;
|
||||
#[cfg(test)]
|
||||
mod tests_envelope_distort;
|
||||
#[cfg(test)]
|
||||
mod tests_envelope_edit;
|
||||
#[cfg(test)]
|
||||
mod tests_expand;
|
||||
#[cfg(test)]
|
||||
mod tests_eyedropper;
|
||||
#[cfg(test)]
|
||||
mod tests_file;
|
||||
#[cfg(test)]
|
||||
mod tests_fileinfo;
|
||||
#[cfg(test)]
|
||||
mod tests_flatpresets;
|
||||
#[cfg(test)]
|
||||
mod tests_flatpreview;
|
||||
#[cfg(test)]
|
||||
mod tests_flatten;
|
||||
#[cfg(test)]
|
||||
mod tests_focal;
|
||||
#[cfg(test)]
|
||||
mod tests_fontfiles;
|
||||
#[cfg(test)]
|
||||
mod tests_fontlist;
|
||||
#[cfg(test)]
|
||||
mod tests_freeform;
|
||||
#[cfg(test)]
|
||||
mod tests_globaledit;
|
||||
#[cfg(test)]
|
||||
mod tests_gradient;
|
||||
#[cfg(test)]
|
||||
mod tests_gradpanel;
|
||||
#[cfg(test)]
|
||||
mod tests_gradspan;
|
||||
#[cfg(test)]
|
||||
mod tests_halftone;
|
||||
#[cfg(test)]
|
||||
mod tests_history_mem;
|
||||
#[cfg(test)]
|
||||
mod tests_ids_without_selection;
|
||||
#[cfg(test)]
|
||||
mod tests_inline;
|
||||
#[cfg(test)]
|
||||
mod tests_interactivity;
|
||||
#[cfg(test)]
|
||||
mod tests_intertwine;
|
||||
#[cfg(test)]
|
||||
mod tests_journal;
|
||||
#[cfg(test)]
|
||||
mod tests_keyguide;
|
||||
#[cfg(test)]
|
||||
mod tests_knockout;
|
||||
#[cfg(test)]
|
||||
mod tests_labspots;
|
||||
#[cfg(test)]
|
||||
mod tests_large_edits;
|
||||
#[cfg(test)]
|
||||
mod tests_layerclip;
|
||||
#[cfg(test)]
|
||||
mod tests_layers;
|
||||
#[cfg(test)]
|
||||
mod tests_legacy_ai;
|
||||
#[cfg(test)]
|
||||
mod tests_library;
|
||||
#[cfg(test)]
|
||||
mod tests_link_paths;
|
||||
#[cfg(test)]
|
||||
mod tests_linked_stops;
|
||||
#[cfg(test)]
|
||||
mod tests_linkfiles;
|
||||
#[cfg(test)]
|
||||
mod tests_links;
|
||||
#[cfg(test)]
|
||||
mod tests_linkspanel;
|
||||
#[cfg(test)]
|
||||
mod tests_linkwatch;
|
||||
#[cfg(test)]
|
||||
mod tests_liquify;
|
||||
#[cfg(test)]
|
||||
mod tests_live;
|
||||
#[cfg(test)]
|
||||
mod tests_livecorners;
|
||||
#[cfg(test)]
|
||||
mod tests_maskview;
|
||||
#[cfg(test)]
|
||||
mod tests_menucmds;
|
||||
#[cfg(test)]
|
||||
mod tests_nativefile;
|
||||
#[cfg(test)]
|
||||
mod tests_newart;
|
||||
#[cfg(test)]
|
||||
mod tests_newdoc;
|
||||
#[cfg(test)]
|
||||
mod tests_objects_on_path;
|
||||
#[cfg(test)]
|
||||
mod tests_objexpand;
|
||||
#[cfg(test)]
|
||||
mod tests_opacitymask;
|
||||
#[cfg(test)]
|
||||
mod tests_outlineobject;
|
||||
#[cfg(test)]
|
||||
mod tests_outlinestroke;
|
||||
#[cfg(test)]
|
||||
mod tests_overprint;
|
||||
#[cfg(test)]
|
||||
mod tests_package;
|
||||
#[cfg(test)]
|
||||
mod tests_paintproxy;
|
||||
#[cfg(test)]
|
||||
mod tests_panelcmds;
|
||||
#[cfg(test)]
|
||||
mod tests_paragraphs;
|
||||
#[cfg(test)]
|
||||
mod tests_params;
|
||||
#[cfg(test)]
|
||||
mod tests_pathops;
|
||||
#[cfg(test)]
|
||||
mod tests_pathtype;
|
||||
#[cfg(test)]
|
||||
mod tests_pattern;
|
||||
#[cfg(test)]
|
||||
mod tests_pdffidelity;
|
||||
#[cfg(test)]
|
||||
mod tests_pdfmarks;
|
||||
#[cfg(test)]
|
||||
mod tests_pdfpresets;
|
||||
#[cfg(test)]
|
||||
mod tests_pdfraster;
|
||||
#[cfg(test)]
|
||||
mod tests_persp_planes;
|
||||
#[cfg(test)]
|
||||
mod tests_persp_select;
|
||||
#[cfg(test)]
|
||||
mod tests_persp_text;
|
||||
#[cfg(test)]
|
||||
mod tests_perspgrid;
|
||||
#[cfg(test)]
|
||||
mod tests_place;
|
||||
#[cfg(test)]
|
||||
mod tests_placed_document;
|
||||
#[cfg(test)]
|
||||
mod tests_plugins;
|
||||
#[cfg(test)]
|
||||
mod tests_prefs;
|
||||
#[cfg(test)]
|
||||
mod tests_previewbounds;
|
||||
#[cfg(test)]
|
||||
mod tests_print;
|
||||
#[cfg(test)]
|
||||
mod tests_printadvanced;
|
||||
#[cfg(test)]
|
||||
mod tests_printpresets;
|
||||
#[cfg(test)]
|
||||
mod tests_printpreview;
|
||||
#[cfg(test)]
|
||||
mod tests_printps;
|
||||
#[cfg(test)]
|
||||
mod tests_printtiling;
|
||||
#[cfg(test)]
|
||||
mod tests_proxyitems;
|
||||
#[cfg(test)]
|
||||
mod tests_puppetwarp;
|
||||
#[cfg(test)]
|
||||
mod tests_rasterfilters;
|
||||
#[cfg(test)]
|
||||
mod tests_rastersettings;
|
||||
#[cfg(test)]
|
||||
mod tests_recolor;
|
||||
#[cfg(test)]
|
||||
mod tests_recovery;
|
||||
#[cfg(test)]
|
||||
mod tests_reflecthit;
|
||||
#[cfg(test)]
|
||||
mod tests_registration;
|
||||
#[cfg(test)]
|
||||
mod tests_save;
|
||||
#[cfg(test)]
|
||||
mod tests_saveoptions;
|
||||
#[cfg(test)]
|
||||
mod tests_scalestrokes;
|
||||
#[cfg(test)]
|
||||
mod tests_scripts;
|
||||
#[cfg(test)]
|
||||
mod tests_select_ids_first;
|
||||
#[cfg(test)]
|
||||
mod tests_shaper;
|
||||
#[cfg(test)]
|
||||
mod tests_shortcutset;
|
||||
#[cfg(test)]
|
||||
mod tests_simplify_part;
|
||||
#[cfg(test)]
|
||||
mod tests_slices;
|
||||
#[cfg(test)]
|
||||
mod tests_smartguides;
|
||||
#[cfg(test)]
|
||||
mod tests_store;
|
||||
#[cfg(test)]
|
||||
mod tests_strokegeom;
|
||||
#[cfg(test)]
|
||||
mod tests_strokegradient;
|
||||
#[cfg(test)]
|
||||
mod tests_strokereach;
|
||||
#[cfg(test)]
|
||||
mod tests_strokeux;
|
||||
#[cfg(test)]
|
||||
mod tests_stylelib;
|
||||
#[cfg(test)]
|
||||
mod tests_stylepanel;
|
||||
#[cfg(test)]
|
||||
mod tests_styles;
|
||||
#[cfg(test)]
|
||||
mod tests_swatchcmds;
|
||||
#[cfg(test)]
|
||||
mod tests_swatches;
|
||||
#[cfg(test)]
|
||||
mod tests_swatchlib;
|
||||
#[cfg(test)]
|
||||
mod tests_symbolbounds;
|
||||
#[cfg(test)]
|
||||
mod tests_symbollib;
|
||||
#[cfg(test)]
|
||||
mod tests_targeting;
|
||||
#[cfg(test)]
|
||||
mod tests_textcombos;
|
||||
#[cfg(test)]
|
||||
mod tests_textedit;
|
||||
#[cfg(test)]
|
||||
mod tests_textimport;
|
||||
#[cfg(test)]
|
||||
mod tests_tileedge;
|
||||
#[cfg(test)]
|
||||
mod tests_tints;
|
||||
#[cfg(test)]
|
||||
mod tests_toolsettings;
|
||||
#[cfg(test)]
|
||||
mod tests_transformfx;
|
||||
#[cfg(test)]
|
||||
mod tests_transparencygrid;
|
||||
#[cfg(test)]
|
||||
mod tests_trap;
|
||||
#[cfg(test)]
|
||||
mod tests_typearea;
|
||||
#[cfg(test)]
|
||||
mod tests_typescale;
|
||||
#[cfg(test)]
|
||||
mod tests_units;
|
||||
#[cfg(test)]
|
||||
mod tests_variables;
|
||||
#[cfg(test)]
|
||||
mod tests_webexport;
|
||||
#[cfg(test)]
|
||||
mod tests_widthpoints;
|
||||
#[cfg(test)]
|
||||
mod tests_widthprofiles;
|
||||
#[cfg(test)]
|
||||
mod tests_widthtool;
|
||||
#[cfg(test)]
|
||||
mod tests_xform;
|
||||
|
||||
/// Commands that act on the selection and take `ids` by selecting them first (`select.set`, with
|
||||
/// its checks), then running as on the selection: the result and the selection afterwards are the
|
||||
|
||||
@@ -4,6 +4,175 @@ use super::*;
|
||||
use vectorcraft_geom::Point;
|
||||
use vectorcraft_tools::{PointerEvent, PointerKind, ToolKey};
|
||||
|
||||
pub(super) mod adjust;
|
||||
mod appearance;
|
||||
mod areafit;
|
||||
mod assets;
|
||||
mod attributes;
|
||||
mod bboxrotate;
|
||||
mod blendfidelity;
|
||||
mod blendopts;
|
||||
mod blendspine;
|
||||
mod brushlib;
|
||||
mod brushsym;
|
||||
mod build;
|
||||
mod cancel;
|
||||
mod charstroke;
|
||||
pub(super) mod clip;
|
||||
mod clipboard;
|
||||
mod clipflavours;
|
||||
mod clippaint;
|
||||
mod cmdsplit;
|
||||
mod cmykflatten;
|
||||
mod colorguide;
|
||||
mod colorguidelib;
|
||||
pub(super) mod colormgmt;
|
||||
mod colorthemes;
|
||||
mod colourfonts;
|
||||
mod compoundpaint;
|
||||
mod constrain_new;
|
||||
mod constrain_tools;
|
||||
mod containers;
|
||||
mod css;
|
||||
mod cut;
|
||||
mod dashalign;
|
||||
mod distort;
|
||||
mod docsetup;
|
||||
mod draw2;
|
||||
mod editcolors;
|
||||
mod effectedit;
|
||||
mod emptytype;
|
||||
mod envelope;
|
||||
mod envelope_distort;
|
||||
mod envelope_edit;
|
||||
pub(super) mod expand;
|
||||
mod eyedropper;
|
||||
mod file;
|
||||
mod fileinfo;
|
||||
mod flatpresets;
|
||||
mod flatpreview;
|
||||
mod flatten;
|
||||
mod focal;
|
||||
mod fontfiles;
|
||||
mod fontlist;
|
||||
mod freeform;
|
||||
mod globaledit;
|
||||
mod gradient;
|
||||
mod gradpanel;
|
||||
mod gradspan;
|
||||
mod halftone;
|
||||
mod history_mem;
|
||||
mod ids_without_selection;
|
||||
mod inline;
|
||||
mod interactivity;
|
||||
mod intertwine;
|
||||
mod journal;
|
||||
mod keyguide;
|
||||
mod knockout;
|
||||
mod labspots;
|
||||
pub(super) mod large_edits;
|
||||
mod layerclip;
|
||||
mod layers;
|
||||
mod legacy_ai;
|
||||
mod library;
|
||||
mod link_paths;
|
||||
mod linked_stops;
|
||||
mod linkfiles;
|
||||
pub(super) mod links;
|
||||
pub(super) mod linkspanel;
|
||||
mod linkwatch;
|
||||
mod liquify;
|
||||
mod live;
|
||||
mod livecorners;
|
||||
mod maskview;
|
||||
pub(super) mod menucmds;
|
||||
mod nativefile;
|
||||
mod newart;
|
||||
mod newdoc;
|
||||
mod objects_on_path;
|
||||
mod objexpand;
|
||||
mod opacitymask;
|
||||
mod outlineobject;
|
||||
pub(super) mod outlinestroke;
|
||||
mod overprint;
|
||||
mod package;
|
||||
mod paintproxy;
|
||||
mod panelcmds;
|
||||
mod paragraphs;
|
||||
mod params;
|
||||
mod pathops;
|
||||
mod pathtype;
|
||||
mod pattern;
|
||||
mod pdffidelity;
|
||||
mod pdfmarks;
|
||||
mod pdfpresets;
|
||||
mod pdfraster;
|
||||
mod persp_planes;
|
||||
pub(super) mod persp_select;
|
||||
mod persp_text;
|
||||
mod perspgrid;
|
||||
mod place;
|
||||
mod placed_document;
|
||||
mod plugins;
|
||||
mod prefs;
|
||||
mod previewbounds;
|
||||
mod print;
|
||||
mod printadvanced;
|
||||
mod printpresets;
|
||||
mod printpreview;
|
||||
mod printps;
|
||||
mod printtiling;
|
||||
mod proxyitems;
|
||||
mod puppetwarp;
|
||||
mod rasterfilters;
|
||||
mod rastersettings;
|
||||
mod recolor;
|
||||
mod recovery;
|
||||
mod reflecthit;
|
||||
mod registration;
|
||||
mod save;
|
||||
mod saveoptions;
|
||||
mod scalestrokes;
|
||||
mod scripts;
|
||||
mod select_ids_first;
|
||||
mod shaper;
|
||||
mod shortcutset;
|
||||
mod simplify_part;
|
||||
mod slices;
|
||||
mod smartguides;
|
||||
mod store;
|
||||
mod strokegeom;
|
||||
mod strokegradient;
|
||||
mod strokereach;
|
||||
mod strokeux;
|
||||
mod stylelib;
|
||||
mod stylepanel;
|
||||
mod styles;
|
||||
mod swatchcmds;
|
||||
mod swatches;
|
||||
mod swatchlib;
|
||||
mod symbolbounds;
|
||||
mod symbollib;
|
||||
mod targeting;
|
||||
mod textcombos;
|
||||
mod textedit;
|
||||
pub(super) mod textimport;
|
||||
mod tileedge;
|
||||
mod tints;
|
||||
mod toolsettings;
|
||||
mod transformfx;
|
||||
mod transparencygrid;
|
||||
mod trap;
|
||||
mod typearea;
|
||||
mod typescale;
|
||||
mod units;
|
||||
mod variables;
|
||||
mod webexport;
|
||||
mod widthpoints;
|
||||
mod widthprofiles;
|
||||
mod widthtool;
|
||||
mod xform;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", &json!({"width": 800, "height": 600})).unwrap();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
use serde_json::json;
|
||||
use vectorcraft_doc::{Node, NodeKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
pub(crate) fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -5,7 +5,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_color::{BlendMode, Color, GradientKind, Paint};
|
||||
use vectorcraft_doc::{AppearanceItem, Node};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -425,7 +425,7 @@ fn appearance_commands_that_change_nothing_record_no_undo_step() {
|
||||
/// objects and the undo history stay as they were. Numbers, true, false and null still work.
|
||||
#[test]
|
||||
fn appearance_commands_refuse_a_number_or_boolean_given_as_text() {
|
||||
use super::tests::{not_a_number, not_a_switch, not_refused};
|
||||
use crate::tests::{not_a_number, not_a_switch, not_refused};
|
||||
let mut s = session();
|
||||
let a = rect(&mut s, 50.0);
|
||||
let b = rect(&mut s, 200.0);
|
||||
@@ -6,7 +6,7 @@ use vectorcraft_doc::{AreaFit, NodeKind, TextKind, TextObject};
|
||||
use vectorcraft_geom::Rect;
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind, ToolKey};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
const STORY: &str = "The quick brown fox jumps over the lazy dog. A second sentence follows the first one here. Then a third one ends it.";
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_color::{Color, Paint};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -7,7 +7,7 @@ use vectorcraft_doc::{ImageMap, NodeKind};
|
||||
use vectorcraft_geom::{Affine, FillRule};
|
||||
use vectorcraft_render::{RenderOptions, Renderer};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -8,7 +8,7 @@ use vectorcraft_geom::{Point, Rect};
|
||||
use vectorcraft_tools::bbox::Handle;
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -7,7 +7,7 @@ use vectorcraft_color::Paint;
|
||||
use vectorcraft_doc::{Knockout, Node, NodeKind};
|
||||
use vectorcraft_geom::{Point, Rect};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -6,7 +6,7 @@ use vectorcraft_doc::live::{BlendOrientation, BlendSpacing, BlendSpec};
|
||||
use vectorcraft_doc::{Node, NodeKind};
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -8,7 +8,7 @@ use vectorcraft_doc::live::BlendSpec;
|
||||
use vectorcraft_doc::{Node, NodeKind};
|
||||
use vectorcraft_geom::{Point, Rect};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -7,7 +7,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_brush::BrushKind;
|
||||
use vectorcraft_doc::{NodeId, NodeKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -5,7 +5,7 @@ use vectorcraft_doc::{Document, Node, NodeKind};
|
||||
use vectorcraft_geom::Rect;
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -1074,7 +1074,7 @@ fn symbol_stainer_refuses_a_keep_model_given_as_text() {
|
||||
/// document and the undo history stay as they were. Numbers, true, false and null still work.
|
||||
#[test]
|
||||
fn symbol_commands_refuse_a_number_or_boolean_given_as_text() {
|
||||
use super::tests::{not_a_number, not_a_switch, not_refused};
|
||||
use crate::tests::{not_a_number, not_a_switch, not_refused};
|
||||
let mut s = session();
|
||||
let (_, name, b) = make_symbol(&mut s);
|
||||
let at = json!([[b.center().x, b.center().y]]);
|
||||
@@ -9,7 +9,7 @@ use vectorcraft_geom::{Affine, FillRule, PathData, Point, Rect};
|
||||
use vectorcraft_testkit::pdf::{PdfPage, pdf};
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind, ToolKey};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -1734,7 +1734,7 @@ fn live_paint_stroke_edge() {
|
||||
/// and the undo history stay as they were. True, false and null still work.
|
||||
#[test]
|
||||
fn shape_builder_refuses_a_number_or_boolean_given_as_text() {
|
||||
use super::tests::{not_a_number, not_a_switch, not_refused};
|
||||
use crate::tests::{not_a_number, not_a_switch, not_refused};
|
||||
let mut s = session();
|
||||
two(&mut s);
|
||||
let merge = |extra: Value| {
|
||||
@@ -1761,7 +1761,7 @@ fn shape_builder_refuses_a_number_or_boolean_given_as_text() {
|
||||
/// key; the document and the undo history stay as they were. Numbers and null still work.
|
||||
#[test]
|
||||
fn live_paint_and_image_trace_refuse_a_number_or_boolean_given_as_text() {
|
||||
use super::tests::{not_a_number, not_a_switch, not_refused};
|
||||
use crate::tests::{not_a_number, not_a_switch, not_refused};
|
||||
let mut s = session();
|
||||
let g = live(&mut s);
|
||||
let calls = [
|
||||
@@ -6,7 +6,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_color::{Color, Paint};
|
||||
use vectorcraft_doc::{CharStyle, Dash, LineCap, LineJoin, NodeId, NodeKind, StrokeAlign, TextObject};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -5,7 +5,7 @@
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_render::Rendered;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
pub(crate) fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -6,7 +6,7 @@ use vectorcraft_color::{Color, Paint};
|
||||
use vectorcraft_doc::{Document, Node, NodeKind};
|
||||
use vectorcraft_geom::{Point, Rect};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -6,7 +6,7 @@ use vectorcraft_doc::{NodeKind, TextObject};
|
||||
use vectorcraft_geom::Point;
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind, ToolKey};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
use crate::cmd::clipboard::{AI, BITMAP, EPS, FILE_HEAD, PASTE_ORDER, PDF, PNG, SVG, TEXT, file_flavour};
|
||||
|
||||
fn session() -> Session {
|
||||
@@ -6,7 +6,7 @@ use serde_json::json;
|
||||
use vectorcraft_geom::Affine;
|
||||
use vectorcraft_render::{RenderOptions, Renderer};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn rect(s: &mut Session, x: f64, w: f64, fill: &str) -> NodeId {
|
||||
let id = NodeId(s.execute("shape.rectangle", &json!({"x": x, "y": 50, "width": w, "height": 100})).unwrap()["id"].as_u64().unwrap());
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use serde_json::json;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
use crate::cmd::{leaf_targets, paint_targets, unique_name};
|
||||
|
||||
fn session() -> Session {
|
||||
@@ -6,7 +6,7 @@ use vectorcraft_doc::{AppearanceItem, Node, NodeKind};
|
||||
use vectorcraft_geom::{Point, Rect, Shape};
|
||||
use vectorcraft_render::Renderer;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn run(s: &mut Session, id: &str, p: Value) -> Value {
|
||||
s.execute(id, &p).unwrap()
|
||||
@@ -3,7 +3,7 @@
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_color::Color;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -5,7 +5,7 @@ use std::collections::HashSet;
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn hexes(v: &Value) -> Vec<String> {
|
||||
v.as_array().unwrap().iter().map(|h| h.as_str().unwrap().to_string()).collect()
|
||||
@@ -11,7 +11,7 @@ use vectorcraft_geom::Affine;
|
||||
use vectorcraft_render::proof::{ProofSetup, ProofTarget};
|
||||
use vectorcraft_render::{RenderOptions, Renderer};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
/// Every test here reads or changes the process-wide proof view or colour settings: one at a time.
|
||||
/// Tests that switch the Color Settings away from the defaults live in `tests/color_settings.rs`
|
||||
@@ -5,7 +5,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_color::Color;
|
||||
use vectorcraft_color::harmony::Harmony;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn run(s: &mut Session, id: &str, p: Value) -> Value {
|
||||
s.execute(id, &p).unwrap_or_else(|e| panic!("{id}: {e}"))
|
||||
@@ -5,7 +5,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_doc::NodeKind;
|
||||
use vectorcraft_text::test_fonts::{SVG_CHAR, source_sans_gid, svg_font};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -4,7 +4,7 @@
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_color::Paint;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn run(s: &mut Session, id: &str, p: Value) -> Value {
|
||||
s.execute(id, &p).unwrap()
|
||||
@@ -8,7 +8,7 @@ use vectorcraft_doc::{LiveShape, NodeKind, TextKind};
|
||||
use vectorcraft_geom::{PathData, Point, Rect};
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
use PointerKind::{Down, Drag, Up};
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ use vectorcraft_doc::{LiveShape, NodeKind};
|
||||
use vectorcraft_geom::{Point, Vec2};
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind, ToolKey};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn new_doc() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -5,7 +5,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_color::{Color, Paint};
|
||||
use vectorcraft_doc::{Node, NodeKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -4,7 +4,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_doc::NodeKind;
|
||||
use vectorcraft_geom::{FillRule, PathData, Rect};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -5,8 +5,8 @@ use kurbo::Shape;
|
||||
use serde_json::json;
|
||||
use vectorcraft_doc::Dash;
|
||||
|
||||
use super::tests_outlinestroke::{outline, path_of};
|
||||
use super::*;
|
||||
use crate::tests_outlinestroke::{outline, path_of};
|
||||
use crate::*;
|
||||
|
||||
fn session_with_rect() -> (Session, NodeId) {
|
||||
let mut s = Session::new();
|
||||
@@ -5,7 +5,7 @@ use vectorcraft_geom::{PathData, Point, Rect, Shape};
|
||||
use vectorcraft_tools::distort::perspective::{PerspectiveGrid, Plane};
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind, ToolKey};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -5,7 +5,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_doc::{CharPosition, DocSetup, ExportText, GridSize, NodeId, NodeKind, ScriptMetrics, TextObject, TextStyleDef, Unit};
|
||||
use vectorcraft_tools::{PointerEvent, PointerKind, ToolKey};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -5,7 +5,7 @@ use vectorcraft_doc::{NodeId, NodeKind};
|
||||
use vectorcraft_geom::{FillRule, PathData, Point};
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind, ToolKey};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
use crate::tooling::{UiRequest, ViewInfo};
|
||||
|
||||
fn session() -> Session {
|
||||
@@ -1518,8 +1518,8 @@ fn path_commands_refuse_a_boolean_given_as_text() {
|
||||
("path.blob", json!({"points": stroke, "mergeOnlySelection": 1}), "mergeOnlySelection"),
|
||||
("path.blob", json!({"points": stroke, "merge": "false"}), "merge"),
|
||||
]
|
||||
.map(|(cmd, p, key)| super::tests::not_a_switch(cmd, p, key));
|
||||
let wrong = super::tests::not_refused(&mut s, &calls);
|
||||
.map(|(cmd, p, key)| crate::tests::not_a_switch(cmd, p, key));
|
||||
let wrong = crate::tests::not_refused(&mut s, &calls);
|
||||
assert!(wrong.is_empty(), "not refused: {wrong:#?}");
|
||||
s.execute("path.setHandle", &json!({"id": id.0, "anchor": 0, "x": 160, "y": 90, "independent": true})).unwrap();
|
||||
s.execute("path.close", &json!({"id": id.0, "independent": null})).unwrap();
|
||||
@@ -5,7 +5,7 @@ use vectorcraft_color::{Color, Paint};
|
||||
use vectorcraft_doc::Node;
|
||||
use vectorcraft_tools::{PointerEvent, PointerKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
use crate::tooling::ViewInfo;
|
||||
|
||||
fn session() -> Session {
|
||||
@@ -4,7 +4,7 @@
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_doc::Node;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
/// A selected 100×100 rectangle with the default appearance `[Fill white, Stroke black]`.
|
||||
fn session_with_rect() -> (Session, NodeId) {
|
||||
@@ -5,7 +5,7 @@ use serde_json::json;
|
||||
use vectorcraft_doc::{NodeId, NodeKind, TextKind};
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind, SurroundingUnit, ToolKey};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
// Type placed by the Type tools starts empty (Fill New Type Objects With Placeholder Text off).
|
||||
@@ -7,7 +7,7 @@ use vectorcraft_doc::live::{self, EnvelopeKind, EnvelopeOptions, PreserveShape};
|
||||
use vectorcraft_doc::{Knockout, Node, NodeKind, OpacityMask};
|
||||
use vectorcraft_geom::Rect;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
+1
-1
@@ -10,7 +10,7 @@ use vectorcraft_doc::{AppearanceItem, Node, NodeKind, PatternDef, Symbol};
|
||||
use vectorcraft_geom::{Affine, Point, Rect, shapes};
|
||||
use vectorcraft_render::effects;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -7,7 +7,7 @@ use vectorcraft_doc::{EnvelopeKind, Node, NodeKind};
|
||||
use vectorcraft_geom::{Affine, Point, Vec2};
|
||||
use vectorcraft_tools::{PointerEvent, PointerKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -5,8 +5,8 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_color::BlendMode;
|
||||
use vectorcraft_doc::{Node, NodeKind};
|
||||
|
||||
use super::tests_menucmds::{place_undecodable_png, warns_undecoded};
|
||||
use super::*;
|
||||
use crate::tests_menucmds::{place_undecodable_png, warns_undecoded};
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -6,7 +6,7 @@ use vectorcraft_color::{Color, Paint};
|
||||
use vectorcraft_doc::{ImageBlob, ImageObject, Justify, LineCap, Node, NodeKind};
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -1,6 +1,6 @@
|
||||
use serde_json::json;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -4,7 +4,7 @@
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_doc::{CopyrightStatus, DocMetadata};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
use crate::cmd::{FlattenOptions, FlattenerPreset};
|
||||
|
||||
fn run(s: &mut Session, id: &str, p: Value) -> Value {
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
use crate::cmd::flatten::Highlight;
|
||||
|
||||
fn session() -> Session {
|
||||
@@ -7,9 +7,9 @@ use vectorcraft_doc::{AppearanceItem, Node, NodeKind};
|
||||
use vectorcraft_geom::{BezPath, Point, Rect, Shape};
|
||||
use vectorcraft_render::{Rendered, Renderer};
|
||||
|
||||
use super::tests_expand::{RANDOM_CASES, random_transforms};
|
||||
use super::tests_menucmds::{place_undecodable_png, warns_undecoded};
|
||||
use super::*;
|
||||
use crate::tests_expand::{RANDOM_CASES, random_transforms};
|
||||
use crate::tests_menucmds::{place_undecodable_png, warns_undecoded};
|
||||
use crate::*;
|
||||
|
||||
/// Colours here go through the process-wide colour settings, which the colour management tests
|
||||
/// change: one at a time with them.
|
||||
@@ -6,7 +6,7 @@ use vectorcraft_color::{GradientGeom, Paint};
|
||||
use vectorcraft_geom::Point;
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
/// A 200 pt square at (100, 100) with a radial fill centred on it, radius 100.
|
||||
fn radial() -> (Session, NodeId) {
|
||||
@@ -4,7 +4,7 @@
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_text::{FontDb, system_font_dirs};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn names(v: &Value) -> Vec<String> {
|
||||
serde_json::from_value(v.clone()).unwrap()
|
||||
@@ -5,7 +5,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_color::{Color, Freeform, GradientKind, GradientPaint, Paint};
|
||||
use vectorcraft_geom::Point;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -243,7 +243,7 @@ fn lines_join_split_and_follow_the_selection() {
|
||||
/// the undo history stay as they were. Numbers, false and null still work.
|
||||
#[test]
|
||||
fn freeform_commands_refuse_a_number_or_boolean_given_as_text() {
|
||||
use super::tests::{not_a_number, not_a_switch, not_refused};
|
||||
use crate::tests::{not_a_number, not_a_switch, not_refused};
|
||||
let (mut s, id) = freeform_rect();
|
||||
run(&mut s, "paint.freeform.addLine", json!({"points": [0, 1]}));
|
||||
let calls = [
|
||||
@@ -6,7 +6,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_doc::{Node, NodeKind};
|
||||
use vectorcraft_geom::{Affine, PathData, Rect};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -6,7 +6,7 @@ use vectorcraft_color::{Color, Gradient, GradientGeom, GradientKind, GradientPai
|
||||
use vectorcraft_geom::Point;
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind, ToolKey};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -101,7 +101,7 @@ fn bad_gradients_are_rejected_without_editing() {
|
||||
/// the object and the undo history stay as they were. True, false, numbers and null still work.
|
||||
#[test]
|
||||
fn gradient_commands_refuse_a_number_or_boolean_given_as_text() {
|
||||
use super::tests::{not_a_number, not_a_switch, not_refused};
|
||||
use crate::tests::{not_a_number, not_a_switch, not_refused};
|
||||
let mut s = session();
|
||||
let id = rect(&mut s, 0.0, 0.0, 100.0, 100.0);
|
||||
s.execute("paint.setFill", &json!({"gradient": {"kind": "linear"}})).unwrap();
|
||||
@@ -6,7 +6,7 @@ use serde_json::json;
|
||||
use vectorcraft_color::{GradientGeom, Paint};
|
||||
use vectorcraft_geom::Point;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -5,7 +5,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_color::{GradientPaint, Paint};
|
||||
use vectorcraft_geom::{Affine, Point};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use serde_json::json;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
use crate::tests_adjust::{fill_hex, node, red_rect, session};
|
||||
use crate::tests_menucmds::{place_undecodable_png, warns_undecoded};
|
||||
|
||||
@@ -5,7 +5,7 @@ use serde_json::json;
|
||||
use vectorcraft_doc::{Appearance, Node};
|
||||
use vectorcraft_geom::shapes;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
/// A session with one document holding `n` rectangles, all selected.
|
||||
fn session_with_rects(n: usize) -> Session {
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
use serde_json::json;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn doc_with_rect() -> (Session, u64) {
|
||||
let mut s = Session::new();
|
||||
@@ -5,7 +5,7 @@ use vectorcraft_doc::text::INLINE_CHAR;
|
||||
use vectorcraft_doc::{NodeId, NodeKind, TextObject};
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind, ToolKey};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -6,8 +6,8 @@
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_render::Rendered;
|
||||
|
||||
use super::tests_clip::{hit, id_of, render, select, session};
|
||||
use super::*;
|
||||
use crate::tests_clip::{hit, id_of, render, select, session};
|
||||
use crate::*;
|
||||
|
||||
/// Ring A (red, centre 35,50) and ring B (blue, centre 65,50), radius 25, 8 pt strokes, no fill:
|
||||
/// B is in front. The rings cross at (50, 30) and (50, 70).
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
use serde_json::json;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn created(s: &Session) -> Option<i64> {
|
||||
s.doc().unwrap().doc.metadata.created
|
||||
@@ -4,7 +4,7 @@
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -4,7 +4,7 @@
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_doc::Knockout;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -7,8 +7,8 @@ use vectorcraft_color::cms::{self, Model};
|
||||
use vectorcraft_color::{Color, Paint};
|
||||
use vectorcraft_render::proof;
|
||||
|
||||
use super::tests_colormgmt::GLOBAL;
|
||||
use super::*;
|
||||
use crate::tests_colormgmt::GLOBAL;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -10,7 +10,7 @@ use vectorcraft_doc::{Appearance, Document, LAYER_COLORS, LayerColor, Node, Node
|
||||
use vectorcraft_geom::{FillRule, Rect, shapes};
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
/// Squares in a row of [`square_at`].
|
||||
const ROW: usize = 200;
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
use serde_json::json;
|
||||
|
||||
use super::tests_clip::{assert_outputs_agree, hit, id_of, opaque, render, select, session};
|
||||
use super::*;
|
||||
use crate::tests_clip::{assert_outputs_agree, hit, id_of, opaque, render, select, session};
|
||||
use crate::*;
|
||||
|
||||
fn rect(s: &mut Session, x: f64, y: f64, w: f64, h: f64) -> NodeId {
|
||||
id_of(&s.execute("shape.rectangle", &json!({"x": x, "y": y, "width": w, "height": h})).unwrap())
|
||||
@@ -6,7 +6,7 @@
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_doc::{LayerColor, Node, NodeId, NodeKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::tests_menucmds::{place_undecodable_png, place_undecodable_png_sized};
|
||||
use super::*;
|
||||
use crate::tests_menucmds::{place_undecodable_png, place_undecodable_png_sized};
|
||||
use crate::*;
|
||||
use crate::tests_links::Folder;
|
||||
|
||||
/// Three artboards (named A, B and C) with a rectangle on each, on two layers: the first
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -5,7 +5,7 @@
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_doc::{NodeId, NodeKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
use crate::cmd::fileio::touched;
|
||||
use crate::tests_links::{Folder, RED, place, png, session};
|
||||
|
||||
@@ -5,7 +5,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_color::{Color, GradientPaint, GradientStop, Paint};
|
||||
use vectorcraft_render::proof;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -8,7 +8,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_doc::{Document, ImageObject, LinkInfo, NodeKind};
|
||||
use vectorcraft_geom::Rect;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
/// A fresh folder for one test (removed when dropped).
|
||||
pub(crate) struct Folder(pub(crate) PathBuf);
|
||||
@@ -4,8 +4,8 @@
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_doc::{NodeKind, PlacementOptions};
|
||||
|
||||
use super::tests_links::{BLUE, Folder, RED, bounds, centre_colour, image, near, open, place, png, save, session, write};
|
||||
use super::*;
|
||||
use crate::tests_links::{BLUE, Folder, RED, bounds, centre_colour, image, near, open, place, png, save, session, write};
|
||||
use crate::*;
|
||||
|
||||
fn run(s: &mut Session, id: &str, p: Value) -> Value {
|
||||
s.execute(id, &p).unwrap_or_else(|e| panic!("{id} {p}: {e}"))
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
use crate::tests_links::{BLUE, Folder, RED, centre_colour, place, png, session};
|
||||
|
||||
/// Write `bytes` to `path` so its modification time moves even on coarse file systems.
|
||||
@@ -5,7 +5,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_geom::{PathData, Point};
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -6,7 +6,7 @@ use vectorcraft_doc::live::{self, BlendOrientation, BlendSpacing, EnvelopeKind};
|
||||
use vectorcraft_doc::{Node, NodeKind};
|
||||
use vectorcraft_geom::{Point, Rect};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -9,7 +9,7 @@ use vectorcraft_doc::{AnchorRef, LiveCorners, LiveShape, NodeKind};
|
||||
use vectorcraft_geom::Affine;
|
||||
use vectorcraft_geom::shapes::CornerKind;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
/// A 100 × 60 pt live rectangle at (10, 10), selected.
|
||||
fn session() -> (Session, NodeId) {
|
||||
@@ -5,7 +5,7 @@ use serde_json::json;
|
||||
use vectorcraft_geom::Affine;
|
||||
use vectorcraft_render::{RenderOptions, Renderer};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn rect(s: &mut Session, x: f64, w: f64, fill: &str) -> NodeId {
|
||||
let id = NodeId(s.execute("shape.rectangle", &json!({"x": x, "y": 0, "width": w, "height": 200})).unwrap()["id"].as_u64().unwrap());
|
||||
@@ -5,8 +5,8 @@ use vectorcraft_color::{Color, Paint};
|
||||
use vectorcraft_doc::{Appearance, ColorMode, LiveShape, Node, NodeKind, TextKind};
|
||||
use vectorcraft_geom::{Rect, shapes};
|
||||
|
||||
use super::tests_large_edits::{layer, run_soon, square, undo_gives_back};
|
||||
use super::*;
|
||||
use crate::tests_large_edits::{layer, run_soon, square, undo_gives_back};
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -224,7 +224,7 @@ fn tiles_under_squares() -> (Session, Vec<NodeId>, Vec<NodeId>) {
|
||||
let (x, y) = ((t % 40) as f64 * 100.0, (t / 40) as f64 * 200.0);
|
||||
Rect::new(x, y, x + 100.0, y + 200.0)
|
||||
};
|
||||
let s = super::tests_large_edits::session(51_000, |d, k| {
|
||||
let s = crate::tests_large_edits::session(51_000, |d, k| {
|
||||
if k < 1000 { Node::path(d.alloc_id(), shapes::rectangle(tile(k)), Appearance::default_art()) } else { square(d, k - 1000) }
|
||||
});
|
||||
let mut tiles = layer(&s, 0);
|
||||
@@ -3142,7 +3142,7 @@ fn crop_image_trim_checks_the_rgba_size_before_decoding() {
|
||||
// 1-bit gray PNGs, header only: their samples are within the decoder's limit, and as RGBA
|
||||
// (4 bytes a pixel) they are just over or just within the 2 GB allowance.
|
||||
let trim = |w: u32, h: u32| {
|
||||
let png = super::tests_linkspanel::png_header(w, h);
|
||||
let png = crate::tests_linkspanel::png_header(w, h);
|
||||
let mut s = Session::new();
|
||||
s.execute("document.open", &json!({"name": "wall.png", "dataBase64": vectorcraft_format::base64_encode(&png)})).unwrap();
|
||||
s.execute("select.all", &json!({})).unwrap();
|
||||
@@ -6,7 +6,7 @@ use std::path::PathBuf;
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_format::{is_compressed, sniff};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -5,7 +5,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_color::{BlendMode, Paint};
|
||||
use vectorcraft_doc::{Appearance, Dash, LineCap, Node};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -5,7 +5,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_doc::{Background, ColorMode, Unit};
|
||||
use vectorcraft_geom::Rect;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn new_doc(p: Value) -> Session {
|
||||
let mut s = Session::new();
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_geom::{Point, Rect};
|
||||
|
||||
use super::tests_clip::{id_of, select};
|
||||
use super::*;
|
||||
use crate::tests_clip::{id_of, select};
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -8,7 +8,7 @@ use vectorcraft_color::{BlendMode, Color, Paint};
|
||||
use vectorcraft_doc::{AppearanceItem, Node, NodeKind};
|
||||
use vectorcraft_geom::Rect;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -6,7 +6,7 @@ use serde_json::{Value, json};
|
||||
use vectorcraft_geom::Affine;
|
||||
use vectorcraft_render::{RenderOptions, Renderer};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
use crate::cmd::maskedit::MASK_EDIT_LAYER;
|
||||
use crate::tests::{history, select_with_a_step_to_redo};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
use serde_json::json;
|
||||
use vectorcraft_doc::{Node, NodeKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -7,7 +7,7 @@ use vectorcraft_color::BlendMode;
|
||||
use vectorcraft_doc::{AppearanceItem, Node, NodeKind};
|
||||
use vectorcraft_geom::{FillRule, PathData, Rect};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -6,7 +6,7 @@ use vectorcraft_doc::{Document, Node, NodeKind};
|
||||
use vectorcraft_geom::Affine;
|
||||
use vectorcraft_render::{RenderOptions, Renderer};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -6,8 +6,8 @@ use std::io::Read;
|
||||
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::tests_links::{BLUE, Folder, RED, open, place, png, save, session, write};
|
||||
use super::*;
|
||||
use crate::tests_links::{BLUE, Folder, RED, open, place, png, save, session, write};
|
||||
use crate::*;
|
||||
|
||||
fn run(s: &mut Session, id: &str, p: Value) -> Value {
|
||||
s.execute(id, &p).unwrap_or_else(|e| panic!("{id} {p}: {e}"))
|
||||
@@ -5,7 +5,7 @@ use serde_json::json;
|
||||
use vectorcraft_color::{Color, Paint};
|
||||
use vectorcraft_doc::NodeKind;
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -4,7 +4,7 @@ use serde_json::json;
|
||||
use vectorcraft_color::{Color, GradientKind, Paint};
|
||||
use vectorcraft_doc::{AppearanceItem, NodeKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -272,7 +272,7 @@ fn artboard_copies_refuse_an_index_that_names_no_artboard() {
|
||||
/// option left out.
|
||||
#[test]
|
||||
fn artboard_commands_refuse_a_boolean_or_number_given_as_text() {
|
||||
use super::tests::{not_a_number, not_a_switch, not_refused};
|
||||
use crate::tests::{not_a_number, not_a_switch, not_refused};
|
||||
let mut s = session();
|
||||
let r = rect(&mut s);
|
||||
s.execute("artboard.new", &json!({})).unwrap();
|
||||
@@ -5,7 +5,7 @@ use serde_json::json;
|
||||
use vectorcraft_doc::{Justify, NodeId, NodeKind, TextObject};
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind, ToolKey};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -5,7 +5,7 @@ use vectorcraft_color::{Color, Paint};
|
||||
use vectorcraft_doc::{Appearance, NodeKind};
|
||||
use vectorcraft_geom::{FillRule, PathData, Rect};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
@@ -6,7 +6,7 @@ use vectorcraft_doc::{NodeKind, PathAlign, TextKind, TextObject};
|
||||
use vectorcraft_geom::{Point, Rect, Shape};
|
||||
use vectorcraft_tools::{Mods, PointerEvent, PointerKind};
|
||||
|
||||
use super::*;
|
||||
use crate::*;
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user