Skip to content

Commit

Permalink
Updates unit tests with renderer implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
hobnob committed Oct 11, 2024
1 parent e08c1e9 commit 64076f6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package indigoextras.ui

import indigo.platform.assets.DynamicText
import indigo.platform.renderer.Renderer
import indigo.shared.AnimationsRegister
import indigo.shared.BoundaryLocator
import indigo.shared.FontRegister
Expand Down Expand Up @@ -281,7 +282,8 @@ class InputFieldTests extends munit.FunSuite {
Dice.loaded(1),
new InputState(Mouse.default, new Keyboard(keysUp, Batch.empty, None), Gamepad.default, Pointers.default),
new BoundaryLocator(new AnimationsRegister, new FontRegister, new DynamicText),
()
(),
Renderer.blackHole
)

object Samples {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ final class RendererWebGL1(
private given CanEqual[Option[Int], Option[Int]] = CanEqual.derived

def captureScreen(
@SuppressWarnings(Array("scalafix:DisableSyntax.defaultArgs"))
clippingRect: Rectangle = Rectangle(Size(screenWidth, screenHeight)),
@SuppressWarnings(Array("scalafix:DisableSyntax.defaultArgs"))
excludeLayers: Batch[BindingKey] = Batch.empty
): Batch[Byte] = {
val canvas = dom.document.createElement("canvas").asInstanceOf[html.Canvas]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ final class RendererWebGL2(
var orthographicProjectionMatrixNoMagFlipped: scalajs.js.Array[Float] = null

// Store previous data in order to take screenshots
@SuppressWarnings(Array("scalafix:DisableSyntax.var", "scalafix:DisableSyntax.null"))
@SuppressWarnings(Array("scalafix:DisableSyntax.var"))
private var _prevSceneData: ProcessedSceneData = null
@SuppressWarnings(Array("scalafix:DisableSyntax.var"))
private var _prevGameRuntime: Seconds = Seconds.zero
Expand Down Expand Up @@ -233,7 +233,9 @@ final class RendererWebGL2(
private given CanEqual[Option[Int], Option[Int]] = CanEqual.derived

def captureScreen(
@SuppressWarnings(Array("scalafix:DisableSyntax.defaultArgs"))
clippingRect: Rectangle = Rectangle(Size(screenWidth, screenHeight)),
@SuppressWarnings(Array("scalafix:DisableSyntax.defaultArgs"))
excludeLayers: Batch[BindingKey] = Batch.empty
): Batch[Byte] = {
val canvas = dom.document.createElement("canvas").asInstanceOf[html.Canvas]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package indigo.entry

import indigo.platform.assets.DynamicText
import indigo.platform.renderer.Renderer
import indigo.shared.AnimationsRegister
import indigo.shared.BoundaryLocator
import indigo.shared.FontRegister
Expand Down Expand Up @@ -34,7 +35,8 @@ class StandardFrameProcessorTests extends munit.FunSuite {
Batch(EventsOnlyEvent.Increment),
InputState.default,
Dice.loaded(0),
boundaryLocator
boundaryLocator,
Renderer.blackHole
)

val outModel = outcome.unsafeGet._1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package indigo.scenes

import indigo.platform.assets.DynamicText
import indigo.platform.renderer.Renderer
import indigo.shared.AnimationsRegister
import indigo.shared.BoundaryLocator
import indigo.shared.FontRegister
Expand All @@ -18,7 +19,8 @@ object FakeFrameContext {
Dice.loaded(sides),
InputState.default,
new BoundaryLocator(new AnimationsRegister, new FontRegister, new DynamicText),
()
(),
Renderer.blackHole
)

def context(sides: Int, time: Seconds): FrameContext[Unit] =
Expand All @@ -27,7 +29,8 @@ object FakeFrameContext {
Dice.loaded(sides),
InputState.default,
new BoundaryLocator(new AnimationsRegister, new FontRegister, new DynamicText),
()
(),
Renderer.blackHole
)

def context(sides: Int, time: Seconds, delta: Seconds): FrameContext[Unit] =
Expand All @@ -36,7 +39,8 @@ object FakeFrameContext {
Dice.loaded(sides),
InputState.default,
new BoundaryLocator(new AnimationsRegister, new FontRegister, new DynamicText),
()
(),
Renderer.blackHole
)

}

0 comments on commit 64076f6

Please sign in to comment.