From ea634c851036f9ee9feea2ada4ae201da51790ff Mon Sep 17 00:00:00 2001 From: Alex-Vay Date: Sat, 16 Nov 2024 15:51:55 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B8=D0=BC=D0=B5=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=20=D1=82=D0=B5=D1=81=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tests/CircularCloudLayouterTests.cs | 18 ++++++++---------- .../Visualizers/SimpleCloudVisualizer.cs | 1 - 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/cs/TagsCloudVisualization/Tests/CircularCloudLayouterTests.cs b/cs/TagsCloudVisualization/Tests/CircularCloudLayouterTests.cs index ff6621a7c..fefa8fe90 100644 --- a/cs/TagsCloudVisualization/Tests/CircularCloudLayouterTests.cs +++ b/cs/TagsCloudVisualization/Tests/CircularCloudLayouterTests.cs @@ -71,18 +71,18 @@ public void PutNextRectangle_Rectangles_ShouldNotHaveIntersects() => [Test] [Repeat(10)] - public void PutNextRectangle_AllRectanglesCenter_ShoulBeLikeInitCenter() + public void PutNextRectangle_CloudCenterMust_ShouldBeInLayoterCenter() { - var center = cloudLayouter.Center; - var minRectangleSize = 1; var maxRectangleSize = 10; - var treshold = maxRectangleSize / 2; - - cloudLayouter.GenerateCloud(100, 10, maxRectangleSize); + var expectedDiscrepancy = maxRectangleSize; + var minRectangleSize = 1; + var center = cloudLayouter.Center; + + cloudLayouter.GenerateCloud(100, minRectangleSize, maxRectangleSize); var actualCenter = GetCenterOfAllRectangles(cloudLayouter.GeneratedRectangles); - actualCenter.X.Should().BeInRange(center.X - treshold, center.X + treshold); - actualCenter.Y.Should().BeInRange(center.Y - treshold, center.Y + treshold); + actualCenter.X.Should().BeInRange(center.X - expectedDiscrepancy, center.X + expectedDiscrepancy); + actualCenter.Y.Should().BeInRange(center.Y - expectedDiscrepancy, center.Y + expectedDiscrepancy); } [Test] @@ -131,8 +131,6 @@ private double GetMaxDistanceBetweenRectangleAndCenter(List rectangle return maxDistance; } - - private static bool AreRectanglesHaveIntersects(List rectangles) { for (var i = 0; i < rectangles.Count; i++) diff --git a/cs/TagsCloudVisualization/Visualizers/SimpleCloudVisualizer.cs b/cs/TagsCloudVisualization/Visualizers/SimpleCloudVisualizer.cs index 62ac8cbc9..629b47a79 100644 --- a/cs/TagsCloudVisualization/Visualizers/SimpleCloudVisualizer.cs +++ b/cs/TagsCloudVisualization/Visualizers/SimpleCloudVisualizer.cs @@ -1,6 +1,5 @@ using System.Drawing; using System.Drawing.Imaging; -using System.IO; namespace TagsCloudVisualization.Visualizers;