Advertisement
Scriv07

Untitled

Sep 4th, 2017
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. ScriptName GamesTest:SharedUI_ButtonHint extends GamesTest:Framework:Lilac
  2. import Games:Papyrus:Log
  3. import Games:Shared
  4. import Games:Shared:UI:ButtonHint
  5.  
  6.  
  7. ; Events
  8. ;---------------------------------------------
  9.  
  10. Event Games:Shared:UI:Display.OnLoaded(UI:Display akSender, var[] arguments)
  11. Button HelloButton = new Button
  12. HelloButton.Text = "Hello World"
  13. HelloButton.KeyCode = 69
  14.  
  15. ButtonHint.SetButton(HelloButton)
  16. ButtonHint.Show() ; waits for thread
  17. EndEvent
  18.  
  19.  
  20. Event Games:Shared:UI:ButtonHint.OnSelected(UI:ButtonHint akSender, var[] arguments)
  21. ; I need button arguments!
  22. EndEvent
  23.  
  24.  
  25. ; Lilac
  26. ;---------------------------------------------
  27.  
  28. Function TestSuites()
  29. describe("Shared UI ButtonHint", ButtonHintSuite())
  30. EndFunction
  31.  
  32.  
  33. Function beforeEach()
  34. RegisterForCustomEvent(ButtonHint, "OnLoaded")
  35. RegisterForCustomEvent(ButtonHint, "OnSelected")
  36. EndFunction
  37.  
  38.  
  39. Function afterEach()
  40. UnregisterForCustomEvent(ButtonHint, "OnLoaded")
  41. UnregisterForCustomEvent(ButtonHint, "OnSelected")
  42. EndFunction
  43.  
  44.  
  45. ; Test Suites
  46. ;---------------------------------------------
  47.  
  48. bool Function ButtonHintSuite()
  49. it("should be able to load", loadTest())
  50. it("should be able to be shown", shownTest())
  51. it("should be able to be hidden", hiddenTest())
  52. return true
  53. EndFunction
  54.  
  55.  
  56. bool Function loadTest()
  57. expect(ButtonHint.IsLoaded, to, beFalsy)
  58. ButtonHint.Load()
  59. expect(ButtonHint.IsLoaded, to, beTruthy)
  60. return true
  61. EndFunction
  62.  
  63.  
  64. bool Function shownTest()
  65. ButtonHint.Show()
  66. expect(ButtonHint.Visible, to, beTruthy)
  67. return true
  68. EndFunction
  69.  
  70.  
  71. bool Function hiddenTest()
  72. ButtonHint.Hide()
  73. expect(ButtonHint.Visible, to, beFalsy)
  74. return true
  75. EndFunction
  76.  
  77.  
  78. ; Properties
  79. ;---------------------------------------------
  80.  
  81. Group ButtonHint
  82. UI:ButtonHint Property ButtonHint Auto Const Mandatory
  83. EndGroup
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement