[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/DefineE...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/DefineE... |
Date: |
Wed, 29 Nov 2006 10:59:21 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/11/29 10:59:21
Modified files:
. : ChangeLog
testsuite/misc-ming.all:
DefineEditTextVariableNameTest-Runner.cpp
DefineEditTextVariableNameTest.c
Log message:
* testsuite/misc-ming.all/DefineEditTextVariableNameTest.c:
Add tests for dynamically changing a TextField's variable
name.
*
testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp
Updated and simplified (the most part is done in the
sefl-contained
testcase anyway).
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1816&r2=1.1817
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp?cvsroot=gnash&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-ming.all/DefineEditTextVariableNameTest.c?cvsroot=gnash&r1=1.17&r2=1.18
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1816
retrieving revision 1.1817
diff -u -b -r1.1816 -r1.1817
--- ChangeLog 29 Nov 2006 10:48:33 -0000 1.1816
+++ ChangeLog 29 Nov 2006 10:59:20 -0000 1.1817
@@ -1,5 +1,10 @@
2006-11-29 Sandro Santilli <address@hidden>
+ * testsuite/misc-ming.all/DefineEditTextVariableNameTest.c:
+ Add tests for dynamically changing a TextField's variable name.
+ * testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp
+ Updated and simplified (the most part is done in the sefl-contained
+ testcase anyway).
* server/edit_text_character.{cpp,h}:
Allow programmatically setting a TextField's
variable name.
Index: testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp
===================================================================
RCS file:
/sources/gnash/gnash/testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp 29 Nov
2006 08:23:45 -0000 1.8
+++ testsuite/misc-ming.all/DefineEditTextVariableNameTest-Runner.cpp 29 Nov
2006 10:59:21 -0000 1.9
@@ -39,33 +39,33 @@
string filename = INPUT_FILENAME;
MovieTester tester(filename);
- gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
- dbglogfile.setVerbosity(1);
-
sprite_instance* root = tester.getRootMovie();
assert(root);
- check_equals(root->get_frame_count(), 3);
+ check_equals(root->get_frame_count(), 8);
check_equals(root->get_play_state(), sprite_instance::PLAY);
check_equals(root->get_current_frame(), 0);
const character* mc1 = tester.findDisplayItemByName(*root, "mc1");
check(mc1);
- const sprite_instance* mc1_sp = \
- dynamic_cast<const sprite_instance*>(mc1);
- assert(mc1_sp);
+ const character* mc2 = tester.findDisplayItemByName(*root, "mc2");
+ check(mc2);
- tester.advance();
+ const character* mc3 = tester.findDisplayItemByName(*root, "mc3");
+ check(mc3);
+ check_equals(root->get_current_frame(), 0);
+ for (int f=root->get_current_frame(); f<root->get_frame_count()-1; ++f)
+ {
+ check_equals(root->get_current_frame(), f);
check_equals(root->get_play_state(), sprite_instance::PLAY);
- check_equals(root->get_current_frame(), 1);
-
tester.advance();
+ }
// does stop() on last frame
check_equals(root->get_play_state(), sprite_instance::STOP);
- check_equals(root->get_current_frame(), 2);
+ check_equals(root->get_current_frame(), root->get_frame_count()-1);
}
Index: testsuite/misc-ming.all/DefineEditTextVariableNameTest.c
===================================================================
RCS file:
/sources/gnash/gnash/testsuite/misc-ming.all/DefineEditTextVariableNameTest.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- testsuite/misc-ming.all/DefineEditTextVariableNameTest.c 28 Nov 2006
17:58:07 -0000 1.17
+++ testsuite/misc-ming.all/DefineEditTextVariableNameTest.c 29 Nov 2006
10:59:21 -0000 1.18
@@ -20,23 +20,33 @@
/*
* Test DefineEditText tag with VariableName
*
- * Uses "embedded" font with chars: "Hello world"
+ * Uses "embedded" font in two textfields with initial
+ * texts "Hello world" and "Hi there".
*
* Then, every second it toggles the text between "Hello",
- * "World" and "" (the empty string) by setting the VariableName.
+ * "World" and "" (the empty string) in the first textfield
+ * and between "Hi", "There" and "" (the empty string) in
+ * the second textfield.
+ *
+ * The text is set assigning a value to the associated
+ * VariableName and verified by getting the TextField's
+ * 'text' member.
+ *
+ * Verifications use the Dejagnu intterface, so you'll see
+ * visual traces of failures and a final visual report
+ * or successes and failures.
+ *
+ * The first TextField characters is stored inside a MovieClip,
+ * and its variables is set on the root.
+ *
+ * The second TextField characters is stored inside a MovieClip,
+ * and its variables is set on a third MovieClip which is placed
+ * *after* the definition of the TextField. Things should still work.
*
- * After every variable set it also traces the value of the
- * VariableName, of the textfield and of it's 'text' member.
- * Note that the traces are both "visual" and normal ("visual"
- * traces use the drawing API).
- *
- * The EditText character is stored inside a MovieClip, and
- * it's variable is set on the root. Note that the ActionScript
- * code also tries to *move* the character trough the variable
- * (incdement varname._x).
+ * Note that the ActionScript code also tries to *move* the character trough
+ * the VariableName (incdement varname._x).
* The correct behaviour is for the character to NOT move
*
- *
* run as ./DefineEditTextVariableNameTest
*/
@@ -99,6 +109,21 @@
SWFMovie_add(mo, (SWFBlock)ac);
}
+// @param txt: make of textfield
+// @param varname: variable name to set
+void
+setVariableName(SWFMovie mo, const char* txt, const char* varname)
+{
+ static const size_t BUFLEN = 512;
+
+ char buf[BUFLEN];
+ SWFAction ac;
+ snprintf(buf, BUFLEN, "%s.variable = \"%s\"; ", txt, varname);
+ buf[BUFLEN-1] = '\0';
+ ac = compileSWFActionCode(buf);
+ SWFMovie_add(mo, (SWFBlock)ac);
+}
+
void
add_text_field(SWFMovieClip mo, SWFBlock font, const char* varname,
const char* text)
@@ -125,6 +150,60 @@
}
+static void
+testVariableNameGetSet(SWFMovie mo, const char *varName1, const char *varName2)
+{
+ char tmp[1024];
+
+ set_text(mo, "Hello", varName1);
+ shift_horizontally(mo, varName1, 10);
+ check_equals(mo, "mc1.textfield.text", "'Hello'", 0);
+ check_equals(mo, varName1, "'Hello'", 0);
+ check_equals(mo, "mc1.textfield._x", "0", 0);
+ check_equals(mo, "mc1._height", "16", 0);
+ check_equals(mo, "mc1._width", "136", 0);
+ check_equals(mo, "mc2._height", "16", 0);
+ check_equals(mo, "mc2._width", "100", 0);
+
+ set_text(mo, "Hi", varName2);
+ shift_horizontally(mo, varName2, 10);
+ check_equals(mo, "mc2.textfield.text", "'Hi'", 0);
+ check_equals(mo, varName2, "'Hi'", 0);
+ check_equals(mo, "mc2.textfield._x", "150", 0);
+ snprintf(tmp, 1024, "'%s'", varName2);
+ check_equals(mo, "mc2.textfield.variable", tmp, 0);
+
+ SWFMovie_nextFrame(mo); /* showFrame */
+
+ set_text(mo, "World", varName1);
+ shift_horizontally(mo, varName1, 10);
+ check_equals(mo, "mc1.textfield.text", "'World'", 0);
+ check_equals(mo, varName1, "'World'", 0);
+ check_equals(mo, "mc1.textfield._x", "0", 0);
+
+ set_text(mo, "There", varName2);
+ shift_horizontally(mo, varName2, 10);
+ check_equals(mo, "mc2.textfield.text", "'There'", 0);
+ check_equals(mo, varName2, "'There'", 0);
+ check_equals(mo, "mc2.textfield._x", "150", 0);
+
+ SWFMovie_nextFrame(mo); /* showFrame */
+
+ set_text(mo, "", varName1);
+ shift_horizontally(mo, varName1, 10);
+ check_equals(mo, "mc1.textfield.text", "''", 0);
+ check_equals(mo, varName1, "''", 0);
+ check_equals(mo, "mc1.textfield._x", "0", 0);
+
+ set_text(mo, "", varName2);
+ shift_horizontally(mo, varName2, 10);
+ check_equals(mo, "mc2.textfield.text", "''", 0);
+ check_equals(mo, varName2, "''", 0);
+ check_equals(mo, "mc2.textfield._x", "150", 0);
+
+ SWFMovie_nextFrame(mo); /* showFrame */
+}
+
int
main(int argc, char** argv)
{
@@ -219,56 +298,31 @@
*
*********************************************/
- char tmp[1024];
+ testVariableNameGetSet(mo, varName1, varName2);
- set_text(mo, "Hello", varName1);
- shift_horizontally(mo, varName1, 10);
- check_equals(mo, "mc1.textfield.text", "'Hello'", 0);
- check_equals(mo, varName1, "'Hello'", 0);
- check_equals(mo, "mc1.textfield._x", "0", 0);
- check_equals(mo, "mc1._height", "16", 0);
- check_equals(mo, "mc1._width", "136", 0);
- check_equals(mo, "mc2._height", "16", 0);
- check_equals(mo, "mc2._width", "100", 0);
- snprintf(tmp, 1024, "'%s'", varName1);
- check_equals(mo, "mc1.textfield.variable", tmp, 0);
-
- set_text(mo, "Hi", varName2);
- shift_horizontally(mo, varName2, 10);
- check_equals(mo, "mc2.textfield.text", "'Hi'", 0);
- check_equals(mo, varName2, "'Hi'", 0);
- check_equals(mo, "mc2.textfield._x", "150", 0);
- snprintf(tmp, 1024, "'%s'", varName2);
- check_equals(mo, "mc2.textfield.variable", tmp, 0);
-
- SWFMovie_nextFrame(mo); /* showFrame */
+ /*********************************************
+ *
+ * Now change the textfields 'variable' property
+ * and test again
+ *
+ *********************************************/
- set_text(mo, "World", varName1);
- shift_horizontally(mo, varName1, 10);
- check_equals(mo, "mc1.textfield.text", "'World'", 0);
- check_equals(mo, varName1, "'World'", 0);
- check_equals(mo, "mc1.textfield._x", "0", 0);
+ {
+ const char* varName1bis = "_root.varName1bis";
+ const char* varName2bis = "_root.varName2bis";
+ setVariableName(mo, "mc1.textfield", varName1bis);
+ setVariableName(mo, "mc2.textfield", varName2bis);
+ testVariableNameGetSet(mo, varName1bis, varName2bis);
+ }
- set_text(mo, "There", varName2);
- shift_horizontally(mo, varName2, 10);
- check_equals(mo, "mc2.textfield.text", "'There'", 0);
- check_equals(mo, varName2, "'There'", 0);
- check_equals(mo, "mc2.textfield._x", "150", 0);
+ /*********************************************
+ *
+ * Print test results
+ *
+ *********************************************/
SWFMovie_nextFrame(mo); /* showFrame */
- set_text(mo, "", varName1);
- shift_horizontally(mo, varName1, 10);
- check_equals(mo, "mc1.textfield.text", "''", 0);
- check_equals(mo, varName1, "''", 0);
- check_equals(mo, "mc1.textfield._x", "0", 0);
-
- set_text(mo, "", varName2);
- shift_horizontally(mo, varName2, 10);
- check_equals(mo, "mc2.textfield.text", "''", 0);
- check_equals(mo, varName2, "''", 0);
- check_equals(mo, "mc2.textfield._x", "150", 0);
-
print_tests_summary(mo);
add_actions(mo, "stop();");
- [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/DefineE..., Sandro Santilli, 2006/11/06
- [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/DefineE..., Sandro Santilli, 2006/11/13
- [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/DefineE..., Sandro Santilli, 2006/11/14
- [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/DefineE..., Sandro Santilli, 2006/11/15
- [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/DefineE..., Sandro Santilli, 2006/11/15
- [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/DefineE..., Sandro Santilli, 2006/11/28
- [Gnash-commit] gnash ChangeLog testsuite/misc-ming.all/DefineE...,
Sandro Santilli <=