mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-06 23:06:43 +02:00
updated testcase
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
// 2D
|
// 2D
|
||||||
include <test_rounded_square.scad>;
|
include <test_rounded_square.scad>;
|
||||||
|
include <test_line2d.scad>;
|
||||||
|
|
||||||
// 2D Shape
|
// 2D Shape
|
||||||
include <test_shape_arc.scad>;
|
include <test_shape_arc.scad>;
|
||||||
@@ -9,4 +10,4 @@ include <test_shape_pie.scad>;
|
|||||||
include <test_shape_square.scad>;
|
include <test_shape_square.scad>;
|
||||||
include <test_shape_trapezium.scad>;
|
include <test_shape_trapezium.scad>;
|
||||||
include <test_shape_superformula.scad>;
|
include <test_shape_superformula.scad>;
|
||||||
include <test_shape_path_extend.scad>;
|
include <test_shape_path_extend.scad>;
|
91
test/test_line2d.scad
Normal file
91
test/test_line2d.scad
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
include <unittest.scad>;
|
||||||
|
|
||||||
|
module test_line2d_cap_square() {
|
||||||
|
echo("==== test_line2d_cap_square ====");
|
||||||
|
|
||||||
|
$fn = 24;
|
||||||
|
|
||||||
|
p1 = [0, 0];
|
||||||
|
p2 = [5, 0];
|
||||||
|
width = 1;
|
||||||
|
|
||||||
|
include <line2d.scad>;
|
||||||
|
|
||||||
|
module cap(point, style) {
|
||||||
|
assertTrue(
|
||||||
|
(point == p1 && style == "CAP_SQUARE") ||
|
||||||
|
(point == p2 && style == "CAP_SQUARE")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_line2d_line(angle, length, width, frags) {
|
||||||
|
assertEqual(0, angle);
|
||||||
|
assertEqual(5, length);
|
||||||
|
assertEqual(1, width);
|
||||||
|
assertEqual(24, frags);
|
||||||
|
}
|
||||||
|
|
||||||
|
line2d(p1 = p1, p2 = p2, width = width);
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_line2d_cap_round() {
|
||||||
|
echo("==== test_line2d_cap_round ====");
|
||||||
|
|
||||||
|
$fn = 24;
|
||||||
|
|
||||||
|
p1 = [0, 0];
|
||||||
|
p2 = [5, 0];
|
||||||
|
width = 1;
|
||||||
|
|
||||||
|
include <line2d.scad>;
|
||||||
|
|
||||||
|
module cap(point, style) {
|
||||||
|
assertTrue(
|
||||||
|
(point == p1 && style == "CAP_ROUND") ||
|
||||||
|
(point == p2 && style == "CAP_ROUND")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_line2d_line(angle, length, width, frags) {
|
||||||
|
assertEqual(0, angle);
|
||||||
|
assertEqual(5, length);
|
||||||
|
assertEqual(1, width);
|
||||||
|
assertEqual(24, frags);
|
||||||
|
}
|
||||||
|
|
||||||
|
line2d(p1 = p1, p2 = p2, width = width,
|
||||||
|
p1Style = "CAP_ROUND", p2Style = "CAP_ROUND");
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_line2d_cap_butt() {
|
||||||
|
echo("==== test_line2d_cap_butt ====");
|
||||||
|
|
||||||
|
$fn = 24;
|
||||||
|
|
||||||
|
p1 = [0, 0];
|
||||||
|
p2 = [5, 0];
|
||||||
|
width = 1;
|
||||||
|
|
||||||
|
include <line2d.scad>;
|
||||||
|
|
||||||
|
module cap(point, style) {
|
||||||
|
assertTrue(
|
||||||
|
(point == p1 && style == "CAP_BUTT") ||
|
||||||
|
(point == p2 && style == "CAP_BUTT")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
module test_line2d_line(angle, length, width, frags) {
|
||||||
|
assertEqual(0, angle);
|
||||||
|
assertEqual(5, length);
|
||||||
|
assertEqual(1, width);
|
||||||
|
assertEqual(24, frags);
|
||||||
|
}
|
||||||
|
|
||||||
|
line2d(p1 = p1, p2 = p2, width = width,
|
||||||
|
p1Style = "CAP_BUTT", p2Style = "CAP_BUTT");
|
||||||
|
}
|
||||||
|
|
||||||
|
test_line2d_cap_square();
|
||||||
|
test_line2d_cap_round();
|
||||||
|
test_line2d_cap_butt();
|
@@ -5,11 +5,10 @@ include <shape_path_extend.scad>;
|
|||||||
include <circle_path.scad>;
|
include <circle_path.scad>;
|
||||||
include <archimedean_spiral.scad>;
|
include <archimedean_spiral.scad>;
|
||||||
|
|
||||||
$fn = 96;
|
|
||||||
|
|
||||||
module test_shape_path_extend_stroke1() {
|
module test_shape_path_extend_stroke1() {
|
||||||
echo("==== test_shape_path_extend_stroke1 ====");
|
echo("==== test_shape_path_extend_stroke1 ====");
|
||||||
|
|
||||||
|
$fn = 96;
|
||||||
stroke1 = [[-5, 2.5], [-2.5, 0], [0, 2.5], [2.5, 0], [5, 2.5]];
|
stroke1 = [[-5, 2.5], [-2.5, 0], [0, 2.5], [2.5, 0], [5, 2.5]];
|
||||||
path_pts1 = circle_path(50, 60);
|
path_pts1 = circle_path(50, 60);
|
||||||
|
|
||||||
@@ -22,7 +21,8 @@ module test_shape_path_extend_stroke1() {
|
|||||||
|
|
||||||
module test_shape_path_extend_stroke2() {
|
module test_shape_path_extend_stroke2() {
|
||||||
echo("==== test_shape_path_extend_stroke2 ====");
|
echo("==== test_shape_path_extend_stroke2 ====");
|
||||||
|
|
||||||
|
$fn = 96;
|
||||||
stroke2 = [[-4, 0], [0, 4], [4, 0]];
|
stroke2 = [[-4, 0], [0, 4], [4, 0]];
|
||||||
pts_angles = archimedean_spiral(
|
pts_angles = archimedean_spiral(
|
||||||
arm_distance = 17,
|
arm_distance = 17,
|
||||||
|
Reference in New Issue
Block a user