您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

87 行
2.0 KiB

  1. --------------------------------------------- 以下是测试用例 ---------------------------------------
  2. function testCoinAnimation()
  3. local nodeBegin = self.ui.Items.Button_AddDiamand
  4. local nodeEnd = self.ui.Items.Button_KeFu
  5. local goldNum = 100
  6. local goldIcon = "jinbi.png"
  7. local endCallback = function()
  8. showTooltip("onEnd")
  9. end
  10. --local sizeRange = cc.size(50, 50)
  11. playCoinAnimation(nodeBegin, nodeEnd, goldNum, goldIcon, endCallback, sizeRange);
  12. end
  13. function testPropAnimation()
  14. local nodeBegin = self.ui.Items.Button_AddDiamand
  15. local nodeEnd = self.ui.Items.Button_KeFu
  16. local propId = 10
  17. playPropAnimation(nodeBegin, nodeEnd, propId);
  18. end
  19. function testCopyStringFromClipboard()
  20. local str = copyStringFromClipboard()
  21. showTooltip(str)
  22. end
  23. function testBezier()
  24. local nodeBegin = self.ui.Items.Button_KeFu
  25. local nodeEnd = self.ui.Items.Button_AddGold
  26. local node1 = self.ui.Items.Layout_test_1
  27. local node2 = self.ui.Items.Layout_test_2
  28. local posBegin = nodeBegin:getWorldPosition()
  29. local posEnd = nodeEnd:getWorldPosition()
  30. local pos1 = node1:getWorldPosition()
  31. local pos2 = node2:getWorldPosition()
  32. local node = self.ui.Items.ImageView_5
  33. node:setPosition(posBegin)
  34. local bezier = cc.BezierTo:createWithPoints(1, pos1, pos2, posEnd);
  35. node:runAction(bezier);
  36. end
  37. function testChangeGpsInfo()
  38. local gpsStatus = 0;
  39. local rand = math.random(1, 100)
  40. if rand <= 50 then
  41. gpsStatus = 2;
  42. else
  43. gpsStatus = math.random(0, 3)
  44. end
  45. if gpsStatus == 2 then
  46. app.user.gpsInfo =
  47. {
  48. gpsStatus = gpsStatus,
  49. x = math.random(1000, 9999),
  50. y = math.random(1000, 9999),
  51. }
  52. else
  53. app.user.gpsInfo =
  54. {
  55. gpsStatus = gpsStatus,
  56. x = 0,
  57. y = 0,
  58. }
  59. end
  60. app.user:updateGpsInfo()
  61. showTooltip(tostring(gpsStatus))
  62. end
  63. local idx = 1;
  64. function testDropTips()
  65. idx = idx + 1
  66. app:dropNotice(tostring(idx))
  67. end
  68. --------------------------------------------- 以上是测试用例 ---------------------------------------
  69. function onTest()
  70. testDropTips()
  71. end