Files

36 lines
1.0 KiB
Luau

local RS = game:GetService("ReplicatedStorage")
local G = require(RS:WaitForChild("ImGui"))
local ImNodes = require(RS:WaitForChild("ImNodes"))(G)
local LogicSim = require(RS:WaitForChild("LogicSim"))(G, ImNodes)
local UI = require(RS:WaitForChild("LogicUI"))(G, ImNodes, LogicSim)
local ImGui = G.ImGui
local Impl = G.ImGui_ImplRoblox
ImGui.CreateContext()
Impl.Init()
Impl.SetRenderRate(0)
ImNodes.CreateContext()
local io = ImGui.GetIO()
local function frame(before)
Impl.NewFrame()
io.DeltaTime = 1 / 60
if before then before() end
ImGui.NewFrame()
UI.Draw()
ImGui.Render()
end
frame()
frame()
local g = UI.Graph
local victim = g.order[1]
local count = #g.order
assert(g.nodes[victim] and count == 10, "full adder loaded")
ImNodes.SelectNode(victim)
frame(function() io:AddKeyEvent(G.ImGuiKey.Delete, true) end)
frame(function() io:AddKeyEvent(G.ImGuiKey.Delete, false) end)
assert(g.nodes[victim] == nil and #g.order == count - 1, "Delete removed selected node")
assert(ImNodes.NumSelectedNodes() == 0)
print("OK")