changeset 1378:31f57a969ffd

fix: make text-tests buildable again
author sam <sam@basx.dev>
date Sun, 08 Dec 2024 22:00:31 +0700
parents aaf8fa2c7bb2
children 4aa9e703af48
files tests/test_text.nim
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test_text.nim	Sun Dec 08 08:21:27 2024 +0700
+++ b/tests/test_text.nim	Sun Dec 08 22:00:31 2024 +0700
@@ -12,18 +12,22 @@
 type FontDS = object
   fontAtlas: Image[Gray]
 
-proc test_01_static_label_new(time: float32) =
+proc test_01_static_label(time: float32) =
   var font = loadFont("Overhaul.ttf", lineHeightPixels = 160)
   var renderdata = initRenderData()
   var pipeline =
-    createPipeline[GlyphShader[200]](renderPass = vulkan.swapchain.renderPass)
+    createPipeline[DefaultFontShader[FontDS]](renderPass = vulkan.swapchain.renderPass)
 
-  var ds = asDescriptorSetData(GlyphDescriptors[200](fontAtlas: font.fontAtlas.copy()))
+  var ds = asDescriptorSetData(FontDS(fontAtlas: font.fontAtlas.copy()))
   uploadImages(renderdata, ds)
   initDescriptorSet(renderdata, pipeline.layout(0), ds)
 
+  var label1 =
+    initTextbox(renderdata, pipeline.layout(0), font, 0.0005, "Hello semicongine!")
+
   var start = getMonoTime()
   while ((getMonoTime() - start).inMilliseconds().int / 1000) < time:
+    label1.refresh()
     withNextFrame(framebuffer, commandbuffer):
       bindDescriptorSet(commandbuffer, ds, 0, pipeline)
       withRenderPass(
@@ -42,7 +46,8 @@
   destroyPipeline(pipeline)
   destroyRenderData(renderdata)
 
-proc test_01_static_label(time: float32) =
+#[
+proc test_01_static_label_new(time: float32) =
   var font = loadFont("Overhaul.ttf", lineHeightPixels = 160)
   var renderdata = initRenderData()
   var pipeline =
@@ -82,6 +87,7 @@
   checkVkResult vkDeviceWaitIdle(vulkan.device)
   destroyPipeline(pipeline)
   destroyRenderData(renderdata)
+  ]#
 
 proc test_02_multiple_animated(time: float32) =
   var font1 = loadFont("Overhaul.ttf", lineHeightPixels = 40)
@@ -287,7 +293,7 @@
     setupSwapchain(renderpass = renderpass)
 
     # tests a simple triangle with minimalistic shader and vertex format
-    test_01_static_label_new(time)
+    # test_01_static_label_new(time)
     test_01_static_label(time)
     test_02_multiple_animated(time)
     test_03_layouting(time)