本文整理汇总了C++中MovieClip::getPlayState方法的典型用法代码示例。如果您正苦于以下问题:C++ MovieClip::getPlayState方法的具体用法?C++ MovieClip::getPlayState怎么用?C++ MovieClip::getPlayState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MovieClip
的用法示例。
在下文中一共展示了MovieClip::getPlayState方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tester
int
trymain(int /*argc*/, char** /*argv*/)
{
//string filename = INPUT_FILENAME;
string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
MovieTester tester(filename);
MovieClip* root = tester.getRootMovie();
assert(root);
check_equals(root->get_frame_count(), 7);
check_equals(root->get_current_frame(), 0);
tester.advance();
check_equals(root->get_current_frame(), 1);
tester.advance();
check_equals(root->get_current_frame(), 2);
tester.movePointerTo(150, 150);
tester.click();
tester.advance();
check_equals(root->get_current_frame(), 3);
tester.movePointerTo(250, 250);
tester.click();
tester.advance();
check_equals(root->get_current_frame(), 4);
tester.movePointerTo(251, 251);
tester.movePointerTo(252, 251);
tester.movePointerTo(251, 252);
tester.click();
tester.advance();
check_equals(root->get_current_frame(), 5);
tester.advance();
// last advance should not restart the loop (it's in STOP mode)
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_STOP);
check_equals(root->get_current_frame(), 6);
return 0;
}
示例2: tester
int
main(int /*argc*/, char** /*argv*/)
{
string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
MovieTester tester(filename);
gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
dbglogfile.setVerbosity(1);
MovieClip* root = tester.getRootMovie();
assert(root);
check_equals(root->get_frame_count(), 5);
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
check_equals(root->get_current_frame(), 0);
for (int i=0; i<30; ++i)
tester.advance();
// TODO: use check_pixel for checking bacground colors
}
示例3: tester
int
main(int /*argc*/, char** /*argv*/)
{
//string filename = INPUT_FILENAME;
string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
MovieTester tester(filename);
std::string idleString = "Idle";
MovieClip* root = tester.getRootMovie();
assert(root);
check_equals(root->get_frame_count(), 7);
check_equals(root->get_current_frame(), 0);
const TextField* text = dynamic_cast<const TextField*>(
tester.findDisplayItemByName(*root, "textfield"));
check(text);
const TextField* text2 = dynamic_cast<const TextField*>(
tester.findDisplayItemByName(*root, "textfield2"));
check(text2);
const TextField* text3 = dynamic_cast<const TextField*>(
tester.findDisplayItemByName(*root, "textfield3"));
check(text3);
check_equals(string(text->get_text_value()), idleString);
check_equals(string(text2->get_text_value()), idleString);
check_equals(string(text3->get_text_value()), idleString);
tester.advance();
check_equals(root->get_current_frame(), 1);
const DisplayObject* mc1 = tester.findDisplayItemByName(*root, "square1");
check(mc1);
check_equals(mc1->get_depth(), 2+DisplayObject::staticDepthOffset);
check(!tester.isMouseOverMouseEntity());
check(!tester.usingHandCursor());
// check that pixel @ 60,60 is red !
rgba red(255,0,0,255);
check_pixel(60, 60, 2, red, 2);
tester.advance();
check_equals(root->get_current_frame(), 2);
tester.advance();
check_equals(root->get_current_frame(), 2); // need to roll out
tester.movePointerTo(60, 60); // roll over the square
check(tester.isMouseOverMouseEntity());
check(tester.usingHandCursor());
check_equals(root->get_current_frame(), 2); // need to roll out
tester.movePointerTo(0, 0); // roll out, should go to next frame
check(!tester.isMouseOverMouseEntity());
check(!tester.usingHandCursor());
check_equals(root->get_current_frame(), 3);
for (size_t fno=root->get_current_frame(); fno<root->get_frame_count(); fno++)
{
const DisplayObject* square_back = tester.findDisplayItemByDepth(*root, 1+DisplayObject::staticDepthOffset);
const DisplayObject* square_front = tester.findDisplayItemByDepth(*root, 3+DisplayObject::staticDepthOffset);
switch (fno)
{
case 3:
check(!square_back);
check(!square_front);
break;
case 4:
check(square_back);
check(!square_front);
break;
case 5:
check(square_back);
check(square_front);
break;
}
check_equals(root->get_current_frame(), fno);
info (("testing mouse activity in frame %d", root->get_current_frame()));
test_mouse_activity(tester, text, text2, square_front!=NULL, fno != root->get_frame_count()-1);
// TODO: test key presses !
// They seem NOT to trigger immediate redraw
tester.advance();
}
// last advance should not restart the loop (it's in STOP mode)
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_STOP);
check_equals(root->get_current_frame(), 6);
}
示例4: tester
int
main(int /*argc*/, char** /*argv*/)
{
typedef gnash::geometry::SnappingRanges2d<int> Ranges;
typedef gnash::geometry::Range2d<int> Bounds;
string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
MovieTester tester(filename);
gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
dbglogfile.setVerbosity(1);
// Colors we'll use during the test
rgba red(255,0,0,255);
rgba white(255,255,255,255);
rgba black(0,0,0,255);
// Ranges we'll use during the test
Range2d<int> redRange(300,300,360,360);
Range2d<int> blackRange(330,270,450,390);
// Coordinates we'll use during testing
int x_left = 270; // on the left of any DisplayObject
int x_red = 310; // on the red square
int x_int = 340; // on the intersection between the red and black squares
int x_black = 370; // on black square
int x_right = 460; // on the right of any DisplayObject
int y = 330;
Ranges invalidated;
MovieClip* root = tester.getRootMovie();
assert(root);
// FRAME 1 (start)
check_equals(root->get_frame_count(), 4);
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
check_equals(root->get_current_frame(), 0);
check_equals(root->getDisplayList().size(), 1); // dejagnu clip
invalidated = tester.getInvalidatedRanges();
check( invalidated.contains(76, 4) ); // the "-xtrace enabled-" label...
tester.advance(); // FRAME 2, place DisplayObjects (black on top)
invalidated = tester.getInvalidatedRanges();
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
check_equals(root->get_current_frame(), 1);
check_equals(root->getDisplayList().size(), 3); // dejagnu + red square + black square
// check invalidated bounds contain both the red and black square
check( invalidated.contains(redRange) );
check( invalidated.contains(blackRange) );
// Check that the black square is over the red square
check_pixel(x_left, y, 2, white, 2);
check_pixel(x_red, y, 2, red, 2);
check_pixel(x_int, y, 2, black, 2); // black is *over* red square
check_pixel(x_black, y, 2, black, 2);
check_pixel(x_right, y, 2, white, 2);
tester.advance(); // FRAME 3, depth-swap the two DisplayObjects
invalidated = tester.getInvalidatedRanges();
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
check_equals(root->get_current_frame(), 2);
check_equals(root->getDisplayList().size(), 3); // dejagnu + red square + black square
// check invalidated bounds to contain the intersection
// between the two DisplayObjects.
//
check( invalidated.contains(Intersection(redRange,blackRange)) );
// Check that the black square is now behind the red square
check_pixel(x_left, y, 2, white, 2);
check_pixel(x_red, y, 2, red, 2);
check_pixel(x_int, y, 2, red, 2); // black is *behind* red square
check_pixel(x_black, y, 2, black, 2);
check_pixel(x_right, y, 2, white, 2);
tester.advance(); // FRAME 4, jump to frame 2 and stop
invalidated = tester.getInvalidatedRanges();
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_STOP);
check_equals(root->get_current_frame(), 1);
check_equals(root->getDisplayList().size(), 3); // dejagnu + red square + black square
// Invalidated bounds can't be Null because something is printed
// in the XTRACE window... Anyway, the squares should be far enoguh
// to assume the invalidated bounds won't contain their intersection
//
// Gnash has an huge invalidated bounds for the whole movie lifetime, btw....
//
xcheck( ! invalidated.intersects(Intersection(redRange,blackRange)) );
// Check that the black square is still behind the red square
check_pixel(x_left, y, 2, white, 2);
check_pixel(x_red, y, 2, red, 2);
check_pixel(x_int, y, 2, red, 2); // black is *behind* red square
check_pixel(x_black, y, 2, black, 2);
check_pixel(x_right, y, 2, white, 2);
//.........这里部分代码省略.........
示例5: tester
int
main(int /*argc*/, char** /*argv*/)
{
typedef gnash::geometry::SnappingRanges2d<int> Ranges;
typedef gnash::geometry::Range2d<int> Bounds;
string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
MovieTester tester(filename);
gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
dbglogfile.setVerbosity(1);
// Colors we'll use during the test
rgba red(255,0,0,255);
rgba green(0,255,0,255);
rgba white(255,255,255,255);
// Ranges we'll use during the test
Range2d<int> redRange(100,300,160,360);
Range2d<int> greenRange(130,330,190,390);
Ranges invalidated;
MovieClip* root = tester.getRootMovie();
assert(root);
// FRAME 1 (start)
check_equals(root->get_frame_count(), 4);
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
check_equals(root->get_current_frame(), 0);
check_equals(root->getDisplayList().size(), 1); // dejagnu clip
invalidated = tester.getInvalidatedRanges();
check( invalidated.contains(76, 4) ); // the "-xtrace enabled-" label...
tester.advance(); // FRAME 2, place DisplayObject
invalidated = tester.getInvalidatedRanges();
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
check_equals(root->get_current_frame(), 1);
check_equals(root->getDisplayList().size(), 2); // dejagnu + red char
// check invalidated bounds contain the red instance (100,300 - 160,360)
check( invalidated.contains(redRange) );
// check that we have a red square at (100,300 - 160,360)
check_pixel(104, 304, 2, red, 2); // UL
check_pixel(156, 304, 2, red, 2); // UR
check_pixel(156, 356, 2, red, 2); // LL
check_pixel(104, 356, 2, red, 2); // LR
// and nothing around it...
check_pixel( 96, 330, 2, white, 2); // Left
check_pixel(164, 330, 2, white, 2); // Right
check_pixel(130, 296, 2, white, 2); // Top
check_pixel(130, 364, 2, white, 2); // Bottom
tester.advance(); // FRAME 3, replace DisplayObject
invalidated = tester.getInvalidatedRanges();
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
check_equals(root->get_current_frame(), 2);
check_equals(root->getDisplayList().size(), 2); // dejagnu + green char
// check invalidated bounds to contain:
// - the green square (added)
// - the red square (removed)
//
check( invalidated.contains(redRange) );
check( invalidated.contains(greenRange) );
// check that we have a green square at (130,330 - 190,390)
check_pixel(134, 334, 2, green, 2); // UL
check_pixel(186, 334, 2, green, 2); // UR
check_pixel(186, 386, 2, green, 2); // LL
check_pixel(134, 386, 2, green, 2); // LR
// and nothing around it...
check_pixel(126, 360, 2, white, 2); // Left
check_pixel(194, 360, 2, white, 2); // Right
check_pixel(160, 326, 2, white, 2); // Top
check_pixel(160, 394, 2, white, 2); // Bottom
tester.advance(); // FRAME 4, jump to frame 2 and stop
invalidated = tester.getInvalidatedRanges();
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_STOP);
check_equals(root->get_current_frame(), 1);
check_equals(root->getDisplayList().size(), 2); // dejagnu + red char
// check invalidated bounds to contain:
// - the green square (removed)
// - the red square (added)
//
check( invalidated.contains(redRange) );
check( invalidated.contains(greenRange) );
// check that we have a red square at (100,300 - 160,360)
check_pixel(104, 304, 2, red, 2); // UL
check_pixel(156, 304, 2, red, 2); // UR
check_pixel(156, 356, 2, red, 2); // LL
//.........这里部分代码省略.........
示例6: tester
int
main(int /*argc*/, char** /*argv*/)
{
string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
MovieTester tester(filename);
gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
dbglogfile.setVerbosity(1);
MovieClip* root = tester.getRootMovie();
assert(root);
if ( ! tester.canTestRendering() )
{
cout << "UNTESTED: rendering of embedded video (testing not possible with this build)." << endl;
return EXIT_SUCCESS; // so testing doesn't abort
}
rgba red(255,0,0,255);
rgba yellow(255,255,0,255);
// TODO: change the scaling of the window/canvas
int scale_x = 1;
int scale_y = 1;
size_t framecount = root->get_frame_count();
check_equals(framecount, 12);
// Just loop twice, so to catch crashes...
for (int j = 0; j < 2; ++j) {
if ( ! tester.canTestVideo() )
{
// no pixel checking, but we'd still be interested in crashes...
tester.advance();
continue;
}
// Frame 1
check_equals(root->get_current_frame(), 0); // 0-based
// Check the color in (5,5) - should be red
check_pixel(5, 5, 2, red, 5);
// Check the color in (35,5) - should be yellow
check_pixel(35*scale_x, 5, 2, yellow, 5);
// Check the color in (5,35) - should be yellow
check_pixel(5, 35*scale_y, 2, yellow, 5);
while (true)
{
// Frame X
tester.advance();
size_t framenum = root->get_current_frame();
assert(framenum > 0);
cout << "---- Pixel checking in frame " << framenum+1 << " play state " << root->getPlayState() << endl;
size_t i = (framenum-1)*10;
// Check the color in (5+i,5) - should be yellow
check_pixel((5 + i)*scale_x, 5, 2, yellow, 5);
// Check the color in (25+i,5) - should be red
check_pixel((25 + i)*scale_x, 5, 2, red, 5);
// Check the color in (25+i,35) - should be yellow
check_pixel((25 + i)*scale_x, 35*scale_y, 1, yellow, 5);
// The video is 128x96 so we don't want to check beyond that
if (45+i <= 128) {
// Check the color in (45+i,5) - should be yellow
check_pixel((45 + i)*scale_x, 5, 2, yellow, 5);
}
if (framenum + 2 == framecount) {
// check we're playing, or we'll never get to next loop...
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
break;
}
tester.click();
}
tester.advance();
// Check the color in (5,5) - should be yellow. Well, anything
// but white or transparent.
check_pixel(5, 5, 2, yellow, 5);
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_STOP);
tester.click();
// Sanity check
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
tester.advance();
}
//.........这里部分代码省略.........
示例7: tester
int
main(int /*argc*/, char** /*argv*/)
{
string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
MovieTester tester(filename);
gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
dbglogfile.setVerbosity(1);
MovieClip* root = tester.getRootMovie();
assert(root);
as_value tmp;
check_equals(root->get_frame_count(), 6);
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
check_equals(root->get_current_frame(), 0);
check(! tester.findDisplayItemByDepth(*root, 70) );
check(! tester.findDisplayItemByDepth(*root, 71) );
check(! tester.findDisplayItemByDepth(*root, 72) );
check(! tester.findDisplayItemByDepth(*root, 73) );
tester.movePointerTo(30, 30);
check(!tester.isMouseOverMouseEntity());
// check that the pixel under the mouse is white
check_pixel(30, 30, 2, rgba(255,255,255,255), 2);
tester.advance();
check(tester.findDisplayItemByDepth(*root, 70) );
check(! tester.findDisplayItemByDepth(*root, 71) );
check(! tester.findDisplayItemByDepth(*root, 72) );
check(! tester.findDisplayItemByDepth(*root, 73) );
tester.movePointerTo(30, 30);
check(tester.isMouseOverMouseEntity());
// check that the pixel under the mouse is red
check_pixel(30, 30, 2, rgba(255,0,0,255), 2);
tester.movePointerTo(100, 30);
check(!tester.isMouseOverMouseEntity());
// check that the pixel under the mouse is white
check_pixel(100, 30, 2, rgba(255,255,255,255), 2);
VM& vm = tester.vm();
const ObjectURI& mousedown = getURI(vm, "mousedown");
const ObjectURI& mouseup = getURI(vm, "mouseup");
getObject(root)->get_member(mousedown, &tmp);
check(tmp.is_undefined());
getObject(root)->get_member(mouseup, &tmp);
check(tmp.is_undefined());
// Note that we are *not* on an active entity !
tester.pressMouseButton();
getObject(root)->get_member(mousedown, &tmp);
check_equals(toNumber(tmp, vm), 1);
check ( ! getObject(root)->get_member(mouseup, &tmp) );
tester.depressMouseButton();
getObject(root)->get_member(mousedown, &tmp);
check_equals(toNumber(tmp, vm), 1);
getObject(root)->get_member(mouseup, &tmp);
check_equals(toNumber(tmp, vm), 1);
tester.advance();
check( tester.findDisplayItemByDepth(*root, 70) );
check( tester.findDisplayItemByDepth(*root, 71) );
check(! tester.findDisplayItemByDepth(*root, 72) );
check(! tester.findDisplayItemByDepth(*root, 73) );
tester.movePointerTo(100, 30);
check(tester.isMouseOverMouseEntity());
// check that the pixel under the mouse is red
check_pixel(100, 30, 2, rgba(255,0,0,255), 2);
tester.movePointerTo(170, 30);
check(!tester.isMouseOverMouseEntity());
// check that the pixel under the mouse is white
check_pixel(170, 30, 2, rgba(255,255,255,255), 2);
tester.advance();
check( tester.findDisplayItemByDepth(*root, 70) );
check( tester.findDisplayItemByDepth(*root, 71) );
check( tester.findDisplayItemByDepth(*root, 72) );
check(! tester.findDisplayItemByDepth(*root, 73) );
tester.movePointerTo(170, 30);
check(tester.isMouseOverMouseEntity());
// check that the pixel under the mouse is red
check_pixel(170, 30, 2, rgba(255,0,0,255), 2);
tester.movePointerTo(240, 30);
check(!tester.isMouseOverMouseEntity());
// check that the pixel under the mouse is white
//.........这里部分代码省略.........
示例8: tester
int
main(int /*argc*/, char** /*argv*/)
{
string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
MovieTester tester(filename);
gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
dbglogfile.setVerbosity(1);
MovieClip* root = tester.getRootMovie();
assert(root);
check_equals(root->get_frame_count(), 4);
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
check_equals(root->get_current_frame(), 0);
rgba white(255,255,255,255);
rgba red(255,0,0,255);
rgba green(0,255,0,255);
geometry::Point2d cXmm(220,327); // DisplayObject X center
geometry::Point2d cXum(220,440); // DisplayObject X underline/middle
geometry::Point2d cOmr(135,326); // DisplayObject O middle/right
geometry::Point2d cOml(21,330); // DisplayObject O middle/left
geometry::Point2d cOmm(77,327); // DisplayObject O center
geometry::Point2d cOum(78,440); // DisplayObject O underline/middle
tester.advance(); // first frame only contains dejagnu
check_equals(root->get_current_frame(), 1);
check_pixel(cXmm.x, cXmm.y, 4, red, 2); // X cross
check_pixel(cXum.x, cXum.y, 20, white, 2); // X underline (none)
check_pixel(cOmm.x, cOmm.y, 8, white, 2); // O hole
check_pixel(cOml.x, cOml.y, 4, green, 2); // O left side
check_pixel(cOmr.x, cOmr.y, 4, green, 2); // O right side
check_pixel(cOum.x, cOum.y, 20, white, 2); // O underline (none)
tester.advance();
// Move to left part of O
tester.movePointerTo(cOml.x, cOml.y);
// Click there
tester.click();
// Move to centre of O
tester.movePointerTo(cOmm.x, cOmm.y);
// Click there a lot (shouldn't be registered)
tester.click();
tester.click();
tester.click();
tester.click();
tester.click();
tester.click();
tester.click();
tester.click();
// Move to right part of O
tester.movePointerTo(cOmr.x, cOmr.y);
// Click there.
tester.click();
tester.movePointerTo(1, 1);
// Just for fun. These shouldn't be registered.
tester.click();
tester.click();
tester.click();
tester.click();
tester.click();
for (int i=0; i<3; ++i) tester.advance(); // get to the end
VM& vm = tester.vm();
as_value eot;
bool endOfTestFound = getObject(root)->get_member(getURI(vm, "endoftest"), &eot);
check(endOfTestFound);
check(eot.is_bool());
check(eot.to_bool(8));
// TODO: use check_pixel for checking bacground colors
}
示例9: tester
int
main(int /*argc*/, char** /*argv*/)
{
string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
MovieTester tester(filename);
gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
dbglogfile.setVerbosity(1);
MovieClip* root = tester.getRootMovie();
assert(root);
check_equals(root->get_frame_count(), 6);
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
check_equals(root->get_current_frame(), 0);
check(! tester.findDisplayItemByDepth(*root, 71) );
check(! tester.findDisplayItemByDepth(*root, 72) );
tester.movePointerTo(30, 30);
check(!tester.isMouseOverMouseEntity());
tester.advance();
check_equals(root->get_current_frame(), 1);
check( tester.findDisplayItemByDepth(*root, 71) );
check(! tester.findDisplayItemByDepth(*root, 72) );
tester.movePointerTo(30, 30);
check(tester.isMouseOverMouseEntity());
tester.movePointerTo(100, 30);
check(!tester.isMouseOverMouseEntity());
tester.advance();
check_equals(root->get_current_frame(), 2);
check(tester.findDisplayItemByDepth(*root, 71) );
check(tester.findDisplayItemByDepth(*root, 72) );
tester.movePointerTo(30, 30);
check(tester.isMouseOverMouseEntity());
tester.movePointerTo(100, 30);
check(tester.isMouseOverMouseEntity());
tester.advance();
check_equals(root->get_current_frame(), 3);
check(tester.findDisplayItemByDepth(*root, 71) );
check(tester.findDisplayItemByDepth(*root, 72) );
check(tester.findDisplayItemByDepth(*root, 73) );
tester.movePointerTo(30, 30);
check(tester.isMouseOverMouseEntity());
tester.movePointerTo(100, 30);
check(tester.isMouseOverMouseEntity());
tester.movePointerTo(170, 30);
check(tester.isMouseOverMouseEntity());
tester.advance();
check_equals(root->get_current_frame(), 4);
tester.movePointerTo(30, 30);
check(tester.isMouseOverMouseEntity());
tester.movePointerTo(100, 30);
check(tester.isMouseOverMouseEntity());
tester.movePointerTo(170, 30);
check(tester.isMouseOverMouseEntity());
tester.movePointerTo(240, 30);
check(tester.isMouseOverMouseEntity());
tester.advance();
check_equals(root->get_current_frame(), 5);
tester.advance();
check_equals(root->get_current_frame(), 5); // we should be in stop mode
}
示例10: tester
int
main(int /*argc*/, char** /*argv*/)
{
string filename = string(TGTDIR) + string("/") + string(INPUT_FILENAME);
MovieTester tester(filename);
MovieClip* root = tester.getRootMovie();
assert(root);
check_equals(root->get_frame_count(), 2);
check_equals(root->get_current_frame(), 0);
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_STOP);
const DisplayObject* ch = tester.findDisplayItemByName(*root, "mc_in_root");
check(ch);
const MovieClip* mc = dynamic_cast<const MovieClip*>(ch);
check(mc);
check_equals(mc->get_current_frame(), 0);
check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
tester.advance();
check_equals(root->get_current_frame(), 0); // we were in stop mode
check_equals(mc->get_current_frame(), 1);
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_STOP);
check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
tester.advance();
check_equals(root->get_current_frame(), 0); // we were in stop mode
check_equals(mc->get_current_frame(), 2);
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_STOP);
check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
tester.advance();
check_equals(root->get_current_frame(), 0); // we were in stop mode
check_equals(mc->get_current_frame(), 0);
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
tester.advance();
check_equals(root->get_current_frame(), 1);
check_equals(mc->get_current_frame(), 1);
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
tester.advance();
check_equals(root->get_current_frame(), 0); // looped
check_equals(mc->get_current_frame(), 2);
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
tester.advance();
check_equals(root->get_current_frame(), 1);
check_equals(mc->get_current_frame(), 0);
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
tester.advance();
check_equals(root->get_current_frame(), 0); // looped again
check_equals(mc->get_current_frame(), 1);
check_equals(root->getPlayState(), MovieClip::PLAYSTATE_PLAY);
check_equals(mc->getPlayState(), MovieClip::PLAYSTATE_PLAY);
return 0;
}