Advertisement
Guest User

Untitled

a guest
Nov 29th, 2018
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.87 KB | None | 0 0
  1. // -- test name = "set_the_icon_of_btn" -- //
  2.  
  3. local test_count, test_name, user_name, output_dir
  4.  
  5. on openCard
  6. put "desktop1_atmosk" into user_name
  7. put "set_the_icon_of_btn" into test_name
  8. put "F:/LiveCode/Scripts/output.txt" into output_dir
  9. put 0 into test_count
  10. if the environment is "development" then exit openCard
  11. send SetupTest to me in 500 milliseconds
  12. end openCard
  13.  
  14. command SetupTest
  15. if exists(btn 1) then
  16. send Testing to me in 500 milliseconds
  17. exit SetupTest
  18. end if
  19. set the width of templateButton to 50
  20. set the height of templateButton to 50
  21. lock screen
  22. repeat with y = 0 to 9 times
  23. repeat with x = 0 to 9 times
  24. set the left of templateButton to x*50
  25. set the top of templateButton to y*50
  26. create btn
  27. end repeat
  28. end repeat
  29. unlock screen
  30. send Testing to me in 500 milliseconds
  31. end SetupTest
  32.  
  33. command Testing
  34. add 1 to test_count
  35. get AppendToOutput(TestingItem())
  36.  
  37. if test_count < 5 then
  38. send Testing to me in 500 milliseconds
  39. exit Testing
  40. end if
  41.  
  42. if the environment is "development" then exit Testing
  43. quit
  44. end Testing
  45.  
  46. function TestingItem
  47. put 210002 into icon1
  48. put 210001 into icon2
  49.  
  50. put 100000 into repeat_count
  51. put 100 into normal_count
  52. put 1000 into lockscreen_count
  53.  
  54. --repeat time
  55. set the backgroundcolor of this card to "128,238,238"
  56. put the milliseconds into repeat_milliseconds
  57. repeat with i = 1 to repeat_count times
  58. if icon_icon is icon1 then
  59. put icon2 into icon_icon
  60. else
  61. put icon1 into icon_icon
  62. end if
  63. put trunc(i/normal_count)*normal_count into count_offset
  64. end repeat
  65. put the milliseconds - repeat_milliseconds into repeat_milliseconds
  66. set the backgroundcolor of this card to "238,238,238"
  67.  
  68. --normal time
  69. set the backgroundcolor of this card to "238,128,238"
  70. put the milliseconds into normal_milliseconds
  71. repeat with i = 1 to normal_count times
  72. if icon_icon is icon1 then
  73. put icon2 into icon_icon
  74. else
  75. put icon1 into icon_icon
  76. end if
  77. put i - (trunc((i-1)/normal_count)*normal_count) into offset_i
  78. set the icon of btn offset_i to icon_icon
  79. end repeat
  80. put the milliseconds - normal_milliseconds into normal_milliseconds
  81. set the backgroundcolor of this card to "238,238,238"
  82.  
  83. --lockscreen time
  84. put 0 into lockscreen_milliseconds
  85. repeat with n = 1 to (lockscreen_count/normal_count)
  86. set the backgroundcolor of this card to "238,238,128"
  87. lock screen
  88. put the milliseconds into inner_lockscreen_milliseconds
  89. repeat with i = 1 to lockscreen_count times
  90. if icon_icon is icon1 then
  91. put icon2 into icon_icon
  92. else
  93. put icon1 into icon_icon
  94. end if
  95. put i - (trunc((i-1)/normal_count)*normal_count) into offset_i
  96. set the icon of btn offset_i to icon_icon
  97. end repeat
  98. add the milliseconds - inner_lockscreen_milliseconds to lockscreen_milliseconds
  99. unlock screen
  100. set the backgroundcolor of this card to "238,238,238"
  101. end repeat
  102.  
  103. put normal_milliseconds-((repeat_milliseconds/repeat_count)*normal_count) into normal_milliseconds
  104. put lockscreen_milliseconds-((repeat_milliseconds/repeat_count)*lockscreen_count) into lockscreen_milliseconds
  105. return normal_milliseconds/normal_count & tab & lockscreen_milliseconds/lockscreen_count
  106.  
  107. end TestingItem
  108.  
  109. function AppendToOutput output
  110. put user_name & tab & platform() & tab & systemVersion() & tab & environment() & tab & version() & tab & test_name & tab into infos
  111. put output_dir into dir
  112. put url("file:" & dir) into input
  113. if (input is not empty) then put cr after input
  114. put input & infos & output into url("file:" & dir)
  115. end AppendToOutput
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement