コード例 #1
0
ファイル: InsertTransitions.py プロジェクト: zoombapup/ATF
import FsmUtil

atfDocService.OpenNewDocument(editor)

statesLeft = []
statesRight = []
transitions = []
trnCnt = 10

print "First create a bunch of states"
for i in range(trnCnt):
    statesLeft.append(
        editingContext.InsertState(100, 100 + 50 * i, "Left#" + unicode(i),
                                   64))
for i in range(trnCnt):
    statesRight.append(
        editingContext.InsertState(300, 100 + 50 * i, "Right#" + unicode(i),
                                   64))

print "Now add the transitions"
for i in range(trnCnt):
    transitions.append(
        FsmUtil.AddNewTransitionAndVerify(editingContext, statesLeft[i],
                                          statesRight[i]))
    transitions[i].Label = "Transition#" + unicode(i)

for i in range(trnCnt):
    Test.Equal("Transition#" + unicode(i), transitions[i].Label)

print Test.SUCCESS
コード例 #2
0
#Copyright (c) 2014 Sony Computer Entertainment America LLC. See License.txt.

import sys
sys.path.append("./CommonTestScripts")

import Test
import FsmUtil

atfDocService.OpenNewDocument(editor)
anchorX = 20
anchorY = 20
spacing = 12

print "Start testing adding comments ..."
FsmUtil.AddNewCommentAndVerify(editingContext, anchorX, anchorY, "comment")
FsmUtil.AddNewCommentAndVerify(editingContext, anchorX, anchorY + spacing, "c")
FsmUtil.AddNewCommentAndVerify(editingContext, anchorX, anchorY + 2 * spacing,
                               "c")
FsmUtil.AddNewCommentAndVerify(editingContext, anchorX, anchorY + 3 * spacing,
                               "c")
FsmUtil.AddNewCommentAndVerify(editingContext, anchorX, anchorY + 4 * spacing,
                               "c")
FsmUtil.AddNewCommentAndVerify(editingContext, anchorX, anchorY + 5 * spacing,
                               "comment")

FsmUtil.AddNewCommentAndVerify(editingContext, anchorX + 5 * spacing, anchorY,
                               "ooooooo")
FsmUtil.AddNewCommentAndVerify(editingContext, anchorX + 5 * spacing,
                               anchorY + spacing, "o         o")
FsmUtil.AddNewCommentAndVerify(editingContext, anchorX + 5 * spacing,
                               anchorY + 2 * spacing, "o         o")
コード例 #3
0
#Copyright (c) 2014 Sony Computer Entertainment America LLC. See License.txt.

import sys
sys.path.append("./CommonTestScripts")
import Test
import FsmUtil

atfDocService.OpenNewDocument(editor)

print "Cut and paste one state"
state1 = FsmUtil.AddNewStateAndVerify(editingContext, 100, 100, "cutMe-state",
                                      70)
Test.Equal(1, fsm.States.Count)
atfEdit.Cut()
Test.Equal(0, fsm.States.Count)
atfEdit.Paste()
Test.Equal(1, fsm.States.Count)
Test.Equal(state1.Name, fsm.States[0].Name, "Verify pasted state's name")
Test.Equal(state1.Size, fsm.States[0].Size, "Verify pasted state's size")
Test.NotEqual(state1.Position.X, fsm.States[0].Position.X,
              "Verify pasted state's X moved")
Test.NotEqual(state1.Position.Y, fsm.States[0].Position.Y,
              "Verify pasted state's Y moved")
state2 = FsmUtil.AddNewStateAndVerify(editingContext, 100, 100, "state2", 80)

print "Create a transition for later (can't be copied on its own)"
transition1 = FsmUtil.AddNewTransitionAndVerify(editingContext, fsm.States[0],
                                                fsm.States[1])
transition1.Label = "cutMe - transition"

print "Cut and paste one comment"
コード例 #4
0
#Copyright (c) 2014 Sony Computer Entertainment America LLC. See License.txt.

import sys
sys.path.append("./CommonTestScripts")

import Test
import FsmUtil

doc = atfDocService.OpenNewDocument(editor)
anchorX = 20
anchorY = 20
spacing = 60

print "Start testing adding states ..."
FsmUtil.AddNewStateAndVerify(editingContext, anchorX, anchorY, "h")
FsmUtil.AddNewStateAndVerify(editingContext, anchorX, anchorY + spacing, "h")
FsmUtil.AddNewStateAndVerify(editingContext, anchorX, anchorY + 2*spacing, "h")
FsmUtil.AddNewStateAndVerify(editingContext, anchorX, anchorY + 3*spacing, "h")
FsmUtil.AddNewStateAndVerify(editingContext, anchorX, anchorY + 4*spacing, "h")
FsmUtil.AddNewStateAndVerify(editingContext, anchorX + spacing, anchorY + 2*spacing, "h")
FsmUtil.AddNewStateAndVerify(editingContext, anchorX + 2*spacing, anchorY, "h")
FsmUtil.AddNewStateAndVerify(editingContext, anchorX + 2*spacing, anchorY + spacing, "h")
FsmUtil.AddNewStateAndVerify(editingContext, anchorX + 2*spacing, anchorY + 2*spacing, "h")
FsmUtil.AddNewStateAndVerify(editingContext, anchorX + 2*spacing, anchorY + 3*spacing, "h")
FsmUtil.AddNewStateAndVerify(editingContext, anchorX + 2*spacing, anchorY + 4*spacing, "h")

FsmUtil.AddNewStateAndVerify(editingContext, anchorX + 4*spacing, anchorY, "i")
FsmUtil.AddNewStateAndVerify(editingContext, anchorX + 5*spacing, anchorY, "i")
FsmUtil.AddNewStateAndVerify(editingContext, anchorX + 6*spacing, anchorY, "i")
FsmUtil.AddNewStateAndVerify(editingContext, anchorX + 5*spacing, anchorY + spacing, "i")
FsmUtil.AddNewStateAndVerify(editingContext, anchorX + 5*spacing, anchorY + 2*spacing, "i")
コード例 #5
0
#Copyright (c) 2014 Sony Computer Entertainment America LLC. See License.txt.

import sys
sys.path.append("./CommonTestScripts")
import Test
import FsmUtil
from System.IO import File

doc = atfDocService.OpenNewDocument(editor)

states = []
comments = []
transitions = []
print "Add a few states ..."
states.append(FsmUtil.AddNewStateAndVerify(editingContext, 50, 50, "state",
                                           64))
states.append(
    FsmUtil.AddNewStateAndVerify(editingContext, 300, 100, "statey", 80))
states.append(
    FsmUtil.AddNewStateAndVerify(editingContext, 100, 200, "super troopers",
                                 100))

print "Add a few comments ..."
comments.append(
    FsmUtil.AddNewCommentAndVerify(editingContext, 30, 150, "do the "))
comments.append(FsmUtil.AddNewCommentAndVerify(editingContext, 30, 175, "can"))
comments.append(FsmUtil.AddNewCommentAndVerify(editingContext, 30, 200, "can"))
comments.append(FsmUtil.AddNewCommentAndVerify(editingContext, 30, 225, "can"))

print "Add a few transitions ..."
transitions.append(
コード例 #6
0
#Copyright (c) 2014 Sony Computer Entertainment America LLC. See License.txt.

import sys
sys.path.append("./CommonTestScripts")
import Test
import FsmUtil

atfDocService.OpenNewDocument(editor)

print "Copy and paste one state"
state1 = FsmUtil.AddNewStateAndVerify(editingContext, 100, 100, "copyMe-state",
                                      70)
atfEdit.Copy()
Test.Equal(1, fsm.States.Count)
atfEdit.Paste()
Test.Equal(2, fsm.States.Count)
state2 = fsm.States[1]
Test.Equal(state1.Name, state2.Name, "Verify copied state's name")
Test.Equal(state1.Size, state2.Size, "Verify copied state's size")
state2.Name = "pasted-state"
state2.Size = 100
print "Create a transition for later (can't be copied on its own)"
transition1 = FsmUtil.AddNewTransitionAndVerify(editingContext, state1, state2)
transition1.Label = "copyMe - transition"

print "Copy and paste one comment"
comment1 = FsmUtil.AddNewCommentAndVerify(editingContext, 100, 150,
                                          "copyMe-comment")
atfEdit.Copy()
Test.Equal(1, fsm.Annotations.Count)
atfEdit.Paste()