public void PutNextRectangle_ShouldPutFirstRectangleInCenter() { var size = new Size(50, 70); var rectangle = layouter.PutNextRectangle(size); var expectedLocation = new Point(center.X - size.Width / 2, center.Y - size.Height / 2); rectangle.X.Should().BeInRange( expectedLocation.X - 1, expectedLocation.X + 1); rectangle.Y.Should().BeInRange( expectedLocation.Y - 1, expectedLocation.Y + 1); }
private static IEnumerable <TagInfo> GetTags( int count, Func <int, string> wordGenerator, Func <int, int> fontSizeGenerator) { var layouter = new SpiralRectangleCloudLayouter(new ArchimedeanSpiral(1, 0.05f)); for (var i = 1; i <= count; i++) { var font = new Font(FontFamilyName, fontSizeGenerator(i)); var value = wordGenerator(i); var rectSize = TextRenderer.MeasureText(value, font); var rect = layouter.PutNextRectangle(rectSize); yield return(new TagInfo(value, font, rect)); } }