Skip to content

GregEakin/BlobSallad.net

Repository files navigation

Blob Sallad .NET

I found this little blob engine code, and converted it run in WPF under C#. The GUI drawing code is verified with ApprovalTests.Net. See the Android Kotlin version.

From the website: Blob Sallad

Blob Sallad

Original version by: Björn Lindberg

Sample code

Here's a test that verifies the OohFace. It creates a canvas, sets up the translate tranformation, executes the test code, and verifies the results. If this code produces the same image, as the one approved, the test will pass.

[Test]
public void DrawOohFaceTest()
{
    var canvas = new Canvas {Width = 100, Height = 100};

    var translateTransform = new TranslateTransform(50.0, 50.0);
    var transformGroup = new TransformGroup();
    transformGroup.Children.Add(translateTransform);

    var blob = new Blob(50.0, 50.0, 25.0, 5);
    blob.DrawOohFace(canvas, 3.0, transformGroup);

    var wpf = new ContentControl {Content = canvas};
    WpfApprovals.Verify(wpf);
}

Links:

Author

🔥 Greg Eakin