local F=require("\078\101\120\117\115\085\110\105\116\084\101\115\116\105\110\103")local t=require((((game:GetService("\083\116\097\114\116\101\114\071\117\105")):WaitForChild("\078\101\120\117\115\086\082\067\111\109\112\097\116\105\098\105\108\105\116\121\084\101\115\116\101\114")):WaitForChild("\084\101\115\116\115")):WaitForChild("\083\117\114\102\097\099\101\071\117\105\067\114\097\115\104\084\101\115\116"))local l=F.UnitTest:Extend()function l.Setup(F)F.CuT=t.new()end function l.Teardown(F)if F.SurfaceGui then F.SurfaceGui:Destroy()end end F:RegisterUnitTest((l.new("\083\116\097\116\101\085\112\100\097\116\101\115")):SetRun(function(F)local t=Instance.new("\083\117\114\102\097\099\101\071\117\105")t.Parent=game:GetService("\087\111\114\107\115\112\097\099\101")F.SurfaceGui=t local l=Instance.new("\070\114\097\109\101")l.Parent=t wait()F:AssertEquals(F.CuT.Icon,"\078\079\078\069")local B=Instance.new("\084\101\120\116\066\117\116\116\111\110")B.Parent=t wait()F:AssertEquals(F.CuT.Icon,"\069\082\082\079\082")B:Destroy()F.CuT.Icon="\078\079\078\069"l.Selectable=true wait()F:AssertEquals(F.CuT.Icon,"\069\082\082\079\082")end))return true
--[[
TheNexusAvenger

Tests the SurfaceGuiCrashTest class.
--]]

local NexusUnitTesting = require("NexusUnitTesting")

local SurfaceGuiCrashTest = require(game:GetService("StarterGui"):WaitForChild("NexusVRCompatibilityTester"):WaitForChild("Tests"):WaitForChild("SurfaceGuiCrashTest"))
local SurfaceGuiCrashTestTest = NexusUnitTesting.UnitTest:Extend()



--[[
Sets up the test.
--]]
function SurfaceGuiCrashTestTest:Setup()
    self.CuT = SurfaceGuiCrashTest.new()
end

--[[
Tears down the test.
--]]
function SurfaceGuiCrashTestTest:Teardown()
    if self.SurfaceGui then
        self.SurfaceGui:Destroy()
    end
end

--[[
Tests the state updating.
--]]
NexusUnitTesting:RegisterUnitTest(SurfaceGuiCrashTestTest.new("StateUpdates"):SetRun(function(self)
    --Create a SurfaceGui and make sure the state didn't change.
    local SurfaceGui = Instance.new("SurfaceGui")
    SurfaceGui.Parent = game:GetService("Workspace")
    self.SurfaceGui = SurfaceGui

    --Add a frame and assert the state doesn't change.
    local Frame = Instance.new("Frame")
    Frame.Parent = SurfaceGui
    wait()
    self:AssertEquals(self.CuT.Icon,"NONE")

    --Add a button and assert the state changes.
    local Button = Instance.new("TextButton")
    Button.Parent = SurfaceGui
    wait()
    self:AssertEquals(self.CuT.Icon,"ERROR")

    --Reset the state, remove the button, make the frame selectable, and assert the state changes.
    Button:Destroy()
    self.CuT.Icon = "NONE"
    Frame.Selectable = true
    wait()
    self:AssertEquals(self.CuT.Icon,"ERROR")
end))



return true