-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #300 from baaahs/edit-links
Design mode fixes
- Loading branch information
Showing
15 changed files
with
167 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
src/commonTest/kotlin/baaahs/gl/PreviewShaderBuilderSpec.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package baaahs.gl | ||
|
||
import baaahs.gadgets.Slider | ||
import baaahs.gl.patch.AutoWirer | ||
import baaahs.gl.preview.PreviewShaderBuilder | ||
import baaahs.glsl.Shaders | ||
import baaahs.model.ModelInfo | ||
import baaahs.plugin.Plugins | ||
import baaahs.shows.FakeGlContext | ||
import baaahs.shows.FakeKgl | ||
import describe | ||
import ext.TestCoroutineContext | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.InternalCoroutinesApi | ||
import org.spekframework.spek2.Spek | ||
import kotlin.test.assertNotNull | ||
import kotlin.test.expect | ||
|
||
@InternalCoroutinesApi | ||
object PreviewShaderBuilderSpec : Spek({ | ||
describe<PreviewShaderBuilder> { | ||
val shader by value { Shaders.checkerboard } | ||
val autoWirer by value { AutoWirer(Plugins.safe()) } | ||
val testCoroutineContext by value { TestCoroutineContext("global") } | ||
val previewShaderBuilder by value { | ||
PreviewShaderBuilder(shader, autoWirer, ModelInfo.Empty, CoroutineScope(testCoroutineContext)) | ||
} | ||
val glContext by value { FakeGlContext(FakeKgl()) } | ||
|
||
it("is in Unbuilt state") { | ||
expect(PreviewShaderBuilder.State.Unbuilt) { previewShaderBuilder.state } | ||
} | ||
|
||
context("when startBuilding() is called") { | ||
beforeEachTest { | ||
previewShaderBuilder.startBuilding() | ||
} | ||
|
||
it("is in Linking state") { | ||
expect(PreviewShaderBuilder.State.Linking) { previewShaderBuilder.state } | ||
} | ||
|
||
context("after idle") { | ||
beforeEachTest { testCoroutineContext.runAll() } | ||
|
||
it("is in Linked state") { | ||
expect(PreviewShaderBuilder.State.Linked) { previewShaderBuilder.state } | ||
} | ||
|
||
it("has a previewPatch") { | ||
assertNotNull(previewShaderBuilder.previewPatch) | ||
} | ||
|
||
it("has a linkedPatch") { | ||
assertNotNull(previewShaderBuilder.linkedPatch) | ||
} | ||
|
||
it("has no gadgets yet") { | ||
expect(emptyList()) { previewShaderBuilder.gadgets } | ||
} | ||
|
||
context("when startCompile() is called") { | ||
beforeEachTest { previewShaderBuilder.startCompile(glContext) } | ||
|
||
it("is in Compiling state") { | ||
expect(PreviewShaderBuilder.State.Compiling) { previewShaderBuilder.state } | ||
} | ||
|
||
context("after idle") { | ||
beforeEachTest { testCoroutineContext.runAll() } | ||
|
||
it("is in Success state") { | ||
expect(PreviewShaderBuilder.State.Success) { previewShaderBuilder.state } | ||
} | ||
|
||
it("has gadgets") { | ||
expect(listOf( | ||
Slider("Checkerboard Size", .1f, .001f, 1f), | ||
)) { previewShaderBuilder.gadgets.map { it.gadget } } | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.