calamity-inc / Stand-Feedback

Share your feature suggestions and bug reports for Stand here!
2 stars 0 forks source link

Formatted Org-Names get reset #135

Open Davus0717 opened 3 days ago

Davus0717 commented 3 days ago

Problem description

Steps to reproduce

Davus0717 commented 3 days ago

example test cases:

local org_name = menu.ref_by_command_name("ceoname")
local ceo_start = menu.ref_by_command_name("ceostart")
local ceo_to_mc = menu.ref_by_command_name("ceotomc")
local estimated_reset_max = 80 -- a org-name reset might take a bit

local function perform_test(c: string, m: string)
    util.log($"Performing test: CEO:'{c}' and MC:'{m}'")

    -- set values
    util.yield(1000)
    org_name:trigger(c)
    util.yield(2000)
    ceo_to_mc:trigger()
    util.yield(1000)
    org_name:trigger(m)

    -- check values
    local i = 0
    repeat
        util.yield(1000)
        i += 1
    until i > estimated_reset_max or org_name.value in {"An Organization", "Motorcycle Club"}

    if org_name.value ~= m and i <= estimated_reset_max then 
        util.log($"Test failed: Expected MC-name '{m}' but got '{org_name.value}'")
    end

    ceo_to_mc:trigger()
    util.yield(1000)

    if org_name.value ~= c and i <= estimated_reset_max then
        util.log($"Test failed: Expected CEO-name '{c}' but got '{org_name.value}'")
    end
end

org_name:focus()
ceo_start:trigger()
perform_test("TestCEO", "TestMC") -- normal name
perform_test("Test~b~CEO", "TestMC 2") -- formatted CEOname (fails, both reset)
perform_test("Test Name With 28 Characters", "TestMC 3") -- long name
perform_test("TestCEO 4", "TestMC 4") -- normal name
perform_test("TestCEO 5", "Test ¦MC") -- formatted MCname (fails, both reset)
perform_test("~italic~TestCEO", "TestMC 6") -- formatted CEOname (fails, both reset)
util.toast("OrgName-Tests done", TOAST_ALL)