diff tests/test_text.nim @ 1321:385dbd68a947

did: a TON of copy elimination, some tests run now waaaay faster
author sam <sam@basx.dev>
date Thu, 15 Aug 2024 12:12:27 +0700
parents 5de466f5f087
children 373a4888f6ac
line wrap: on
line diff
--- a/tests/test_text.nim	Wed Aug 14 20:06:51 2024 +0700
+++ b/tests/test_text.nim	Thu Aug 15 12:12:27 2024 +0700
@@ -91,7 +91,7 @@
     withNextFrame(framebuffer, commandbuffer):
       withRenderPass(vulkan.swapchain.renderPass, framebuffer, commandbuffer, vulkan.swapchain.width, vulkan.swapchain.height, vec4(0, 0, 0, 0)):
         withPipeline(commandbuffer, pipeline):
-          for label in labels:
+          for label in labels.litems:
             render(commandbuffer, pipeline, label)
 
       # cleanup
@@ -177,7 +177,7 @@
       scale = rand(0.0002 .. 0.002),
       position = vec3(rand(-0.5 .. 0.5), rand(-0.5 .. 0.5), rand(-0.1 .. 0.1))
     )
-  labels = labels.sortedByIt(-it.position.z)
+  labels.sort(proc(x, y: Textbox): int = cmp(x.position.z, y.position.z), Ascending)
 
   var start = getMonoTime()
   while ((getMonoTime() - start).inMilliseconds().int / 1000) < time: