TEST_F(HTMLTextFormControlElementTest, WordAndSentenceBoundary)
{
    HTMLElement* innerText = textControl().innerEditorElement();
    {
        SCOPED_TRACE("String is value.");
        innerText->removeChildren();
        innerText->setNodeValue("Hel\nlo, text form.\n");
        testBoundary(document(), textControl());
    }
    {
        SCOPED_TRACE("A Text node and a BR element");
        innerText->removeChildren();
        innerText->setNodeValue("");
        innerText->appendChild(Text::create(document(), "Hello, text form."));
        innerText->appendChild(HTMLBRElement::create(document()));
        testBoundary(document(), textControl());
    }
    {
        SCOPED_TRACE("Text nodes.");
        innerText->removeChildren();
        innerText->setNodeValue("");
        innerText->appendChild(Text::create(document(), "Hel\nlo, te"));
        innerText->appendChild(Text::create(document(), "xt form."));
        testBoundary(document(), textControl());
    }
}
TEST_F(HTMLTextFormControlElementTest, SetSelectionRange) {
  EXPECT_EQ(0, textControl().selectionStart());
  EXPECT_EQ(0, textControl().selectionEnd());

  textControl().setInnerEditorValue("Hello, text form.");
  EXPECT_EQ(0, textControl().selectionStart());
  EXPECT_EQ(0, textControl().selectionEnd());

  textControl().setSelectionRange(1, 3);
  EXPECT_EQ(1, textControl().selectionStart());
  EXPECT_EQ(3, textControl().selectionEnd());
}
示例#3
0
void	saveFlashFile(object wind, char *fname, char *name)
{
	FILE	*fp = fopen(fname, "wt");
	object	ctllist = gGetControls(wind);
	object	seq, ctl, cls;

	if (!fp)
		return;

	setDialogName(name);

	fprintf(fp, "\nimport com.integra.system.*;\n\n");
	fprintf(fp, "import com.integra.services.Service;\n");
	fprintf(fp, "import com.integra.services.ServiceResponse;\n\n");
	fprintf(fp, "\nvar  ScalingFactor = %f;\n\n",SCALE_FACTOR);
	fprintf(fp, "var  dlg%s:Dialog = new Dialog();\n",dialogName);
	fprintf(fp, "var  ctl:Object;\n\n");
	if (ctllist)
		for (seq = gSequence(ctllist) ; ctl = gNext(seq) ; ) {
			cls = ClassOf(ctl);
			if (cls == StaticTextControl)
				staticTextControl(fp, ctl);
			else if (cls == TextControl)
				textControl(fp, ctl);
			else if (cls == NumericControl)
				numericControl(fp, ctl);
			else if (cls == DateControl)
				dateControl(fp, ctl);
			else if (cls == PushButton)
				pushButtonControl(fp, ctl);
			else if (cls == RadioButton)
				radioButtonControl(fp, ctl);
			else if (cls == CheckBox)
				checkboxControl(fp, ctl);
			else if (cls == ListBox)
				listboxControl(fp, ctl);
			else if (cls == ComboBox)
				comboboxControl(fp, ctl);
			else if (cls == RectControl)
				rectControl(fp, ctl);
			else if (cls == LineControl)
				lineControl(fp, ctl);
		}
	fprintf(fp, "\n#include \"%s_d.as\"\n", name);
	fprintf(fp, "\n#include \"%s.as\"\n", name);
	fclose(fp);
}