コード例 #1
0
ファイル: T_FIELD1.CPP プロジェクト: cdaffara/symbiandump-os2
/*
Added to test the fix to 'EDNHARN-4NVDHC: Text fields are not removed correctly in edwin'. Deletion
of two fields failed to delete the second one.
*/
void CT_FIELD1::test_multiple_fields()
	{
	INFO_PRINTF1(_L(" - testing multiple fields"));
	test(TheFieldSet->CharCount()==0);
	test(TheFieldSet->FieldCount()==0);

	/*
	Insert two dummy fields and some imaginary text. Dummy fields have the value 'XXX'.
	If the text is represented by 'x's the text will be: "xxXXXxXXXxxxx".
	*/
	CTextField* field1 = TheFieldSet->NewFieldL(KDummyFieldUid);
	TInt ret = TheFieldSet->InsertFieldL(0,field1,KDummyFieldUid);
	test(ret == KErrNone);
	test(TheFieldSet->FieldCount() == 1);
	ret = UpdateField(0);
	test(ret == KErrNone);
	CTextField* field2 = TheFieldSet->NewFieldL(KDummyFieldUid);
	ret = TheFieldSet->InsertFieldL(3,field2,KDummyFieldUid);
	test(ret == KErrNone);
	test(TheFieldSet->FieldCount() == 2);
	ret = UpdateField(3);
	test(ret == KErrNone);
	TheFieldSet->NotifyInsertion(0,2);
	TheFieldSet->NotifyInsertion(5,1);
	TheFieldSet->NotifyInsertion(9,4);
	test(TheFieldSet->CharCount() == 13);

	// Delete the two fields and the character between them.
	TheFieldSet->NotifyDeletion(2,7);
	test(TheFieldSet->FieldCount() == 0);
	test(TheFieldSet->CharCount() == 6);

	TheFieldSet->Reset();
	}
コード例 #2
0
ファイル: view.cpp プロジェクト: An2An96/World-Model
void Window::Action()
{
    E_STEP step;

    while ((step = world->PerformStep()) == STEP_LIVE)
    {
        if (!this->isActiveWindow())
            break;
        if(pause)   break;
        UpdateField();
        QTime time;
        time.start();
        for (; time.elapsed() < period;)
            qApp->processEvents();
        qApp->processEvents();
    }
    UpdateField();
    if(step == STEP_VICTIMS_WIN)
    {
        emit Paused("Start");
        QMessageBox::information(0, "The end", "All predators are dead, victims populated the whole planet!");

    }
    else if(step == STEP_ALL_DEATH)
    {
        emit Paused("Start");
        QMessageBox::information(0, "The end", "Predators killed all the victims and died of hunger!");

    }
}
コード例 #3
0
ファイル: T_FIELD1.CPP プロジェクト: cdaffara/symbiandump-os2
void CT_FIELD1::test2()
// Tests inserting, updating and removing a field
//
	{
	INFO_PRINTF1(_L("- Testing field insertion, update and removal"));
		test(TheFieldSet->CharCount()==0);
		test(TheFieldSet->FieldCount()==0);
	// insert a field
	CTextField* field = TheFieldSet->NewFieldL(KDummyFieldUid);
	TInt ret=TheFieldSet->InsertFieldL(0,field,KDummyFieldUid); // pos=0
		test(ret==KErrNone);
	test(TheFieldSet->CharCount()==0);
		test(TheFieldSet->FieldCount()==1);
	// get its initial value
	ret=UpdateField(0);
		test(ret==KErrNone);
		test(TheFieldSet->CharCount()==3);
		test(TheFieldSet->FieldCount()==1);
	// get its value in a buffer of insufficient size
	HBufC* miniBuf = HBufC::NewLC(0); 
	ret=TheFieldSet->NewFieldValueL(miniBuf,0); // pos=0
	CleanupStack::Pop();
	CleanupStack::PushL(miniBuf);
		test(ret==KErrNone);
	// delete part of the field & update
	TheFieldSet->NotifyDeletion(1,1); // pos=1, len=1
		test(TheFieldSet->CharCount()==2);
		test(TheFieldSet->FieldCount()==1);
	ret=UpdateField(0);
		test(TheFieldSet->CharCount()==3);
		test(TheFieldSet->FieldCount()==1);
	// delete over a zero length
	TheFieldSet->NotifyDeletion(1,0); // pos=1, len=0
		test(TheFieldSet->CharCount()==3);
		test(TheFieldSet->FieldCount()==1);
	TFindFieldInfo info;
	TBool inField=TheFieldSet->FindFields(info,0);
		test(inField);
		test(info.iFieldCountInRange==1);
		test(info.iFirstFieldLen==3);
		test(info.iFirstFieldPos==0);
	// delete all the contents of the field & update
	TheFieldSet->NotifyDeletion(0,3); // pos=0, len=3
		test(TheFieldSet->CharCount()==0);
		test(TheFieldSet->FieldCount()==0);
/*	ret=UpdateField(0);
		test(TheFieldSet->CharCount()==0);
		test(TheFieldSet->FieldCount()==0);
	ret=TheFieldSet->RemoveField(0); // pos=0
		test(ret);
		test(TheFieldSet->CharCount()==3);
		test(TheFieldSet->FieldCount()==0);
*/	// reset the field array
	TheFieldSet->Reset();
	CleanupStack::PopAndDestroy(); // miniBuf
	}
コード例 #4
0
ファイル: T_FIELD1.CPP プロジェクト: cdaffara/symbiandump-os2
void CT_FIELD1::test8()
// Tests inserting, updating and removing a CPageNumberField
//
	{
	INFO_PRINTF1(_L("- Testing CFileNameField"));
		test(TheFieldSet->CharCount()==0);
		test(TheFieldSet->FieldCount()==0);
	// insert a field with default format
	CTextField* field = TheFieldSet->NewFieldL(KFileNameFieldUid);
	TInt ret=TheFieldSet->InsertFieldL(0,field,KFileNameFieldUid); // pos=0
		test(ret==KErrNone);
		test(TheFieldSet->CharCount()==0);
		test(TheFieldSet->FieldCount()==1);
	// get its initial value
	ret=UpdateField(0);
		test(ret==KErrNone);
		test(TheFieldSet->FieldCount()==1);
	// get its value and display it
	HBufC* miniBuf = HBufC::NewLC(5); 
	ret=TheFieldSet->NewFieldValueL(miniBuf,0); // pos=0
	CleanupStack::Pop();
	CleanupStack::PushL(miniBuf);
		test(ret==KErrNone);
	TPtr buf = miniBuf->Des();
	INFO_PRINTF1(_L("  The field value is: "));
	INFO_PRINTF1(buf);
	INFO_PRINTF1(_L("\n"));
	// reset the field array
	TheFieldSet->Reset();
	CleanupStack::PopAndDestroy(); // miniBuf
	}
コード例 #5
0
/*----------------------------------------------------------------------------------------------
	Something has changed in the possibility list.
----------------------------------------------------------------------------------------------*/
void AfDeFeCliRef::ListChanged(int nAction, HVO hvoPssl, HVO hvoSrc, HVO hvoDst, int ipssSrc,
	int ipssDst)
{
	// We don't want to update the field while we are in the middle of saving.
	if (!m_fSaving)
		UpdateField();
}
コード例 #6
0
ファイル: lmsstatus.cpp プロジェクト: JF002/Touchradio
void LmsStatus::Update(const QString& strStatus)
{
    QString token;
    foreach(token, knowTokens)
    {
        int indexCurrent = strStatus.indexOf(token);
        bool found = (indexCurrent != -1);


        int indexNext;
        if(token != "index")
        {
            indexCurrent+=token.count() + 1;
            indexNext = strStatus.indexOf(" ", indexCurrent);
            if(indexNext == -1)
                indexNext = strStatus.count() -1;
        }
        else
        {
            // assume only 1 track is present in the status string
            indexNext = strStatus.count();
        }

        if(found)
        {

            QString currentStr = strStatus.mid(indexCurrent, indexNext - indexCurrent);
            UpdateField(token, currentStr);
        }
    }
コード例 #7
0
ファイル: FieldSetup.cpp プロジェクト: vrosnet/slac-lucretia
FieldSetup::FieldSetup(lucretiaManager* lman)
 : fFieldManager(0),
   fChordFinder(0),
   fEquation(0),
   fElFieldValue(),
   fStepper(0),
   fIntgrDriver(0),
   fMinStep(lman->EMStepSize*m)
{
  fUniform=lman->EMisUniform;
  if (fUniform==1) {
    double magField[3]={0,0,0};
    lman->GetUniformField(magField);
    fMfield = new G4UniformMagField(G4ThreeVector(magField[0]*tesla,magField[1]*tesla,magField[2]*tesla));
    fEquation = new G4EqMagElectricField(fMfield);
  }
  else if (fUniform==2) {
    double eField[3]={0,0,0};
    lman->GetUniformField(eField);
    fEfield = new G4UniformElectricField(G4ThreeVector(eField[0]*kilovolt/m,eField[1]*kilovolt/m,eField[2]*kilovolt/m));
    fEquation = new G4EqMagElectricField(fEfield);
  }
  else {
    fEMfield = new GlobalField(lman); // Gets field data from LucretiaManager object
    fEquation = new G4EqMagElectricField(fEMfield);
  }
  fFieldManager = GetGlobalFieldManager();
  UpdateField(lman);
}
コード例 #8
0
ファイル: T_FIELD1.CPP プロジェクト: cdaffara/symbiandump-os2
void CT_FIELD1::test6()
// Tests CDateTimeFields with non-default formatting
//
	{
	INFO_PRINTF1(_L("- Testing CDateTimeField with non-default formatting"));
		test(TheFieldSet->CharCount()==0);
		test(TheFieldSet->FieldCount()==0);
	// create a field and set format
	CTextField* field = TheFieldSet->NewFieldL(KDateTimeFieldUid);
	((CDateTimeField*)field)->SetFormat(_L("%-A%*I%:1%T%+A")); //
	// insert field
	TInt ret=TheFieldSet->InsertFieldL(0,field,KDateTimeFieldUid); // pos=0
		test(ret==KErrNone);
		test(TheFieldSet->CharCount()==0);
		test(TheFieldSet->FieldCount()==1);
	// get its initial value
	ret=UpdateField(0);
		test(ret==KErrNone);
//		test(TheFieldSet->CharCount()==5);
		test(TheFieldSet->FieldCount()==1);
	// get its value and display it
	HBufC* miniBuf = HBufC::NewLC(5); 
	ret=TheFieldSet->NewFieldValueL(miniBuf,0); // pos=0
	CleanupStack::Pop();
	CleanupStack::PushL(miniBuf);
		test(ret==KErrNone);
	TPtr buf = miniBuf->Des();
	INFO_PRINTF1(_L("  The field value is: "));
	INFO_PRINTF1(buf);
	INFO_PRINTF1(_L("\n"));
	// reset the field array
	TheFieldSet->Reset();
	CleanupStack::PopAndDestroy(); // miniBuf
	}
コード例 #9
0
void CPDFSDK_InterForm::AfterCheckedStatusChange(CPDF_FormField* pField) {
  int nType = pField->GetFieldType();
  if (nType != FIELDTYPE_CHECKBOX && nType != FIELDTYPE_RADIOBUTTON)
    return;

  OnCalculate(pField);
  UpdateField(pField);
}
コード例 #10
0
void CPDFSDK_InterForm::AfterSelectionChange(CPDF_FormField* pField) {
  if (pField->GetFieldType() != FIELDTYPE_LISTBOX)
    return;

  OnCalculate(pField);
  ResetFieldAppearance(pField, nullptr, TRUE);
  UpdateField(pField);
}
コード例 #11
0
ファイル: skydlg.cpp プロジェクト: Chaos99/RTKLIB
//---------------------------------------------------------------------------
void __fastcall TSkyImgDialog::BtnLoadClick(TObject *Sender)
{
    OpenTagDialog->Title="Open Tag";
    if (!OpenTagDialog->Execute()) return;
    Plot->ReadSkyTag(OpenTagDialog->FileName);
    UpdateField();
    Plot->UpdateSky();
}
コード例 #12
0
void mmCustomFieldListDialog::OnMenuSelected(wxCommandEvent& event)
{
    switch(event.GetId())
    {
        case MENU_NEW_FIELD: AddField(); break;
        case MENU_EDIT_FIELD: EditField(); break;
        case MENU_DELETE_FIELD: DeleteField(); break;
        case MENU_UPDATE_FIELD: UpdateField(); break;
        default: break;
    }
}
コード例 #13
0
ファイル: view.cpp プロジェクト: An2An96/World-Model
void Window::Load(const QString& filename)
{
    world = std::make_unique<World>(filename.toStdString().c_str());
    if (field)
        field->close();
    Coord ws = world->GetWorldSize();
    field = new Field(this, ws.x, ws.y);
    field->move(150, 10);
    field->show();
    UpdateField();
    pause = true;
}
コード例 #14
0
ファイル: view.cpp プロジェクト: An2An96/World-Model
void Window::CreateNewWorld()
{
    world = std::make_unique<World>(dialog->HBox->value(), dialog->VBox->value(),
                      dialog->PredBox->value(), dialog->VictBox->value());
    if (field)
        field->close();
    field = new Field(this, dialog->HBox->value(), dialog->VBox->value());
    field->move(150, 10);
    field->show();
    UpdateField();
    pause = true;
}
コード例 #15
0
void RealmList::UpdateRealm(Battlenet::RealmId const& id, const std::string& name, ip::address const& address, ip::address const& localAddr,
    ip::address const& localSubmask, uint16 port, uint8 icon, RealmFlags flag, uint8 timezone, AccountTypes allowedSecurityLevel,
    float population)
{
    // Create new if not exist or update existed
    Realm& realm = _realms[id];

    realm.Keep = true;

    realm.Id = id;
    UpdateField(realm.Name, name, realm.Updated);
    UpdateField(realm.Type, icon, realm.Updated);
    UpdateField(realm.Flags, flag, realm.Updated);
    UpdateField(realm.Timezone, timezone, realm.Updated);
    UpdateField(realm.AllowedSecurityLevel, allowedSecurityLevel, realm.Updated);
    UpdateField(realm.PopulationLevel, population, realm.Updated);
    UpdateField(realm.ExternalAddress, address, realm.Updated);
    UpdateField(realm.LocalAddress, localAddr, realm.Updated);
    UpdateField(realm.LocalSubnetMask, localSubmask, realm.Updated);
    UpdateField(realm.Port, port, realm.Updated);
}
コード例 #16
0
void CPDFSDK_InterForm::AfterValueChange(CPDF_FormField* pField) {
#ifdef PDF_ENABLE_XFA
  SynchronizeField(pField, FALSE);
#endif  // PDF_ENABLE_XFA
  int nType = pField->GetFieldType();
  if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) {
    OnCalculate(pField);
    FX_BOOL bFormatted = FALSE;
    CFX_WideString sValue = OnFormat(pField, bFormatted);
    ResetFieldAppearance(pField, bFormatted ? &sValue : nullptr, TRUE);
    UpdateField(pField);
  }
}
コード例 #17
0
ファイル: swas.cpp プロジェクト: Kerogi/swas
INT_PTR CALLBACK DlgProc(
  _In_ HWND   hDlg,
  _In_ UINT   uMsg,
  _In_ WPARAM wParam,
  _In_ LPARAM lParam
) {
	int wmId, wmEvent;
	static ChromeInfo chromeInfo;
	static TCHAR ltcChromeDetected[MAX_LOADSTRING];
	static TCHAR ltcChromeNotDetected[MAX_LOADSTRING];
	static TCHAR ltcSendSuccess[MAX_LOADSTRING];
	static TCHAR ltcSendFailed[MAX_LOADSTRING];

	static char szVariable[MAX_LOADSTRING];
	static char sRawFilepath[MAX_PATH];
	static char sUrl[MAX_PATH];

	static tstringstream os;

	switch (uMsg)
	{
		case WM_INITDIALOG:
			{
				HINSTANCE hInstance = reinterpret_cast<HINSTANCE>(lParam);
				TCHAR szTemp[MAX_LOADSTRING];
				if (0 != LoadString(hInstance, IDS_APP_TITLE, szTemp, MAX_LOADSTRING)){
					SetWindowText(hDlg, szTemp);
				}
				if (0 != LoadString(hInstance, IDS_BTN_SEND_CAPTION, szTemp, MAX_LOADSTRING)){
					SetDlgItemText(hDlg, IDC_BTN_SEND, szTemp);
				}
				LoadStringOrDefault(hInstance, ltcChromeDetected, MAX_LOADSTRING, IDS_CHROME_DETECTED, g_tcChromeDetected);
				LoadStringOrDefault(hInstance, ltcChromeNotDetected, MAX_LOADSTRING, IDS_CHROME_NOTDETECTED, g_tcChromeNotDetected);

				SetDlgItemText(hDlg, IDC_LBL_CHROME_STATUS, ltcChromeNotDetected);

				LoadStringOrDefault(hInstance, ltcSendFailed, MAX_LOADSTRING, IDS_SEND_FAILED, g_tcSendFailed);
				LoadStringOrDefault(hInstance, ltcSendSuccess, MAX_LOADSTRING, IDS_SEND_SUCCESS, g_tcSendSuccess);

				SetDlgItemText(hDlg, IDC_LBL_SEND_STATUS, TEXT(""));

				if (0 != SetTimer(hDlg,	IDT_REFRESH_CHROME_STATUS, int(1000 / refreshratehz), NULL))
				{
					ShowWindow(GetDlgItem(hDlg, IDC_BTN_REFRESH), SW_HIDE);
				} 
				else 
				{
					if (0 != LoadString(hInstance, IDS_BTN_REFRESH_CAPTION, szTemp, MAX_LOADSTRING)){
						SetDlgItemText(hDlg, IDC_BTN_REFRESH, szTemp);
					}
					ShowWindow(GetDlgItem(hDlg, IDC_BTN_REFRESH), SW_SHOW);
				}
				
				char* pTemp = 0;
				if (AllocAndCopyTCtoMB(&pTemp, g_tcRawFilepath, MAX_PATH)) {
					StringCbCopyA(sRawFilepath, MAX_PATH, pTemp);
					delete[] pTemp;
				}
				pTemp = 0;
				if (AllocAndCopyTCtoMB(&pTemp, g_tcUrl, MAX_PATH)) {
					StringCbCopyA(sUrl, MAX_PATH, pTemp);
					delete[] pTemp;
				}

				StringCbCopyA(szVariable, MAX_LOADSTRING, "filearg");

				UpdateField(hDlg, IDC_EDT_FILEPATH, sRawFilepath, MAX_PATH, true);
				UpdateField(hDlg, IDC_EDT_SEND_URL, sUrl, MAX_PATH, true);
			}
			return TRUE;
		case WM_TIMER: 
			switch (wParam) 
			{ 
				case IDT_REFRESH_CHROME_STATUS: 
					if(DetectChrome(&chromeInfo, g_tcImageName)){
						os.str(TEXT(""));
						os.clear();
						os<<ltcChromeDetected<<" (pid: "<<chromeInfo.dwProcId<<")"<<std::endl;
						SetDlgItemText(hDlg, IDC_LBL_CHROME_STATUS, os.str().c_str());
					} else {
						SetDlgItemText(hDlg, IDC_LBL_CHROME_STATUS, ltcChromeNotDetected);
					}

					return TRUE;
			}
			break;
		case WM_COMMAND:
			wmId    = LOWORD(wParam);
			wmEvent = HIWORD(wParam);
			switch (wmId)
			{
				case IDCANCEL:
						SendMessage(hDlg, WM_CLOSE, 0, 0);
						return TRUE;
				case IDC_BTN_SEND:{
						UpdateField(hDlg, IDC_EDT_FILEPATH, sRawFilepath, MAX_PATH);
						UpdateField(hDlg, IDC_EDT_SEND_URL, sUrl, MAX_PATH);
						TCHAR tcRawFilepath[MAX_PATH];
						TCHAR tcUrl[MAX_PATH];
						TCHAR* pTemp = 0;
						if (AllocAndCopyMBtoTC(&pTemp, sUrl, MAX_PATH)) {
							StringCbCopy(tcUrl, MAX_PATH, pTemp);
							delete[] pTemp;
						} 
						pTemp = 0;
						if (AllocAndCopyMBtoTC(&pTemp, sRawFilepath, MAX_PATH)) {
							StringCbCopy(tcRawFilepath, MAX_PATH, pTemp);
							delete[] pTemp;
						}
						TCHAR tcFullPath[MAX_PATH];
						TCHAR *tcFilenamePart;
						if(CreateFullPath(tcRawFilepath, tcFullPath, sizeof(tcFullPath)/ sizeof(TCHAR), &tcFilenamePart) )
						{
							char* pFilenamePart = 0;
							if (AllocAndCopyTCtoMB(&pFilenamePart, tcFilenamePart, MAX_PATH)) 

							if(SendFile(GetFile(tcFullPath), tcUrl, szVariable, pFilenamePart)) {
								SetDlgItemText(hDlg, IDC_LBL_SEND_STATUS, ltcSendSuccess);
							} else {
								SetDlgItemText(hDlg, IDC_LBL_SEND_STATUS, ltcSendFailed);
							}
							
							if(pFilenamePart) delete[] pFilenamePart;
						}
					}
					return TRUE;	
				case IDC_BTN_REFRESH:
					if(DetectChrome(&chromeInfo, g_tcImageName, true)){
						SetDlgItemText(hDlg, IDC_LBL_CHROME_STATUS, ltcChromeDetected);
					} else {
						SetDlgItemText(hDlg, IDC_LBL_CHROME_STATUS, ltcChromeNotDetected);
					}
					return TRUE;
					
			}
			break;

		case WM_CLOSE:
			KillTimer(hDlg, IDT_REFRESH_CHROME_STATUS);
			DestroyWindow(hDlg);
			return TRUE;
		case WM_DESTROY:
			PostQuitMessage(0);
			return TRUE;
	}

	return FALSE;
}
コード例 #18
0
ファイル: T_FIELD1.CPP プロジェクト: cdaffara/symbiandump-os2
void CT_FIELD1::test3()
// Tests InField() in "all" the oddball situations
//
	{
	TFindFieldInfo info;
	INFO_PRINTF1(_L("- Testing InField() calls"));
		test(TheFieldSet->CharCount()==0);
		test(TheFieldSet->FieldCount()==0);
	// Zero length doc
	TBool inField=TheFieldSet->FindFields(info,0);
		test(!inField);
		test(info.iFieldCountInRange==0);
		test(info.iFirstFieldLen==0);
		test(info.iFirstFieldPos==0);
	// Insert field (zero length) & test before
	CTextField* field = TheFieldSet->NewFieldL(KDummyFieldUid);
	TInt ret=TheFieldSet->InsertFieldL(0,field,KDummyFieldUid); // pos=0
		test(ret==KErrNone);
	inField=TheFieldSet->FindFields(info,0);
		test(inField);
		test(info.iFieldCountInRange==1);
		test(info.iFirstFieldLen==0);
		test(info.iFirstFieldPos==0);
	// Insert another field (zero length) & test before
	CTextField* field2 = TheFieldSet->NewFieldL(KDummyFieldUid);
	ret=TheFieldSet->InsertFieldL(0,field2,KDummyFieldUid); // pos=0
		test(ret==KErrNone);
	inField=TheFieldSet->FindFields(info,0);
		test(inField);
		test(info.iFieldCountInRange==2);
		test(info.iFirstFieldLen==0);
		test(info.iFirstFieldPos==0);
	// Get the value of the first field, test before & test between them
	ret=UpdateField(0);
		test(ret==KErrNone);
	inField=TheFieldSet->FindFields(info,0);
		test(inField);
		test(info.iFieldCountInRange==1);
		test(info.iFirstFieldLen==3);
		test(info.iFirstFieldPos==0);
	inField=TheFieldSet->FindFields(info,3);
		test(inField);
		test(info.iFieldCountInRange==1);
		test(info.iFirstFieldLen==0);
		test(info.iFirstFieldPos==3);
	// Get the value of the second field, test between them
	ret=UpdateField(3);
		test(ret==KErrNone);
	inField=TheFieldSet->FindFields(info,3);
		test(inField);
		test(info.iFieldCountInRange==1);
		test(info.iFirstFieldLen==3);
		test(info.iFirstFieldPos==3);
	// end of doc - after field
	inField=TheFieldSet->FindFields(info,6);
		test(!inField);
		test(info.iFieldCountInRange==0);
		test(info.iFirstFieldLen==0);
		test(info.iFirstFieldPos==0);
	// In field
	inField=TheFieldSet->FindFields(info,2);
		test(inField);
		test(info.iFieldCountInRange==1);
		test(info.iFirstFieldLen==3);
		test(info.iFirstFieldPos==0);
	// Other method at same pos
	inField=TheFieldSet->FindFields(2);
		test(inField);
	// Pretend to insert some text between the fields
	TheFieldSet->NotifyInsertion(3,5); // pos=3, len=5
		test(TheFieldSet->CharCount()==11);
		test(TheFieldSet->FieldCount()==2);
	// Test in text
	inField=TheFieldSet->FindFields(info,6);
		test(info.iFieldCountInRange==0);
		test(info.iFirstFieldLen==0);
		test(info.iFirstFieldPos==0);
	// Test from field to field over the intervening text
	inField=TheFieldSet->FindFields(info,1,9);
		test(info.iFieldCountInRange==2);
		test(info.iFirstFieldLen==3);
		test(info.iFirstFieldPos==0);
	// Test from field 1 up to field 2
	inField=TheFieldSet->FindFields(info,0,8);
		test(info.iFieldCountInRange==1);
		test(info.iFirstFieldLen==3);
		test(info.iFirstFieldPos==0);
	TheFieldSet->Reset();
	}
コード例 #19
0
ファイル: skydlg.cpp プロジェクト: Chaos99/RTKLIB
//---------------------------------------------------------------------------
void __fastcall TSkyImgDialog::FormShow(TObject *Sender)
{
    UpdateField();
    UpdateEnable();
}
コード例 #20
0
ファイル: T_FIELD1.CPP プロジェクト: cdaffara/symbiandump-os2
void CT_FIELD1::test4()
// Tests Insertion and deletion of text around and into fields
//
	{
	TFindFieldInfo info;
	INFO_PRINTF1(_L("- Testing insertion and deletion of text around and into fields"));
		test(TheFieldSet->CharCount()==0);
		test(TheFieldSet->FieldCount()==0);
	// Insert some text
	TheFieldSet->NotifyInsertion(0,4); // pos=0, len=4
		test(TheFieldSet->CharCount()==4);
		test(TheFieldSet->FieldCount()==0);
	// Insert some text into the text
	TheFieldSet->NotifyInsertion(2,6); // pos=2, len=6
		test(TheFieldSet->CharCount()==10);
		test(TheFieldSet->FieldCount()==0);
	// Insert a field into the text
	CTextField* field = TheFieldSet->NewFieldL(KDummyFieldUid);
	TInt ret=TheFieldSet->InsertFieldL(4,field,KDummyFieldUid); // pos=4
	if(ret != KErrNone && field !=NULL)
		{
		delete field;
		field = NULL;
		}
		test(ret==KErrNone);
	ret=UpdateField(4);
		test(ret==KErrNone);
		test(TheFieldSet->CharCount()==13);
		test(TheFieldSet->FieldCount()==1);
	// Insert some text directly before the field (check it hasn't inserted into the field)
	TheFieldSet->NotifyInsertion(4,2); // pos=4, len=2
		test(TheFieldSet->CharCount()==15);
		test(TheFieldSet->FieldCount()==1);
	TBool inField=TheFieldSet->FindFields(info,7); // pos=7
		test(info.iFieldCountInRange==1);
		test(info.iFirstFieldLen==3);
		test(info.iFirstFieldPos==6);
	// Insert some text directly after the field
	TheFieldSet->NotifyInsertion(9,1); // pos=9, len=1
		test(TheFieldSet->CharCount()==16);
		test(TheFieldSet->FieldCount()==1);
	inField=TheFieldSet->FindFields(info,7); // pos=7
		test(info.iFieldCountInRange==1);
		test(info.iFirstFieldLen==3);
		test(info.iFirstFieldPos==6);
	// Insert some text into the field
	TheFieldSet->NotifyInsertion(7,4); // pos=9, len=4
		test(TheFieldSet->CharCount()==20);
		test(TheFieldSet->FieldCount()==1);
	inField=TheFieldSet->FindFields(info,7); // pos=7
		test(info.iFieldCountInRange==1);
		test(info.iFirstFieldLen==7);
		test(info.iFirstFieldPos==6);
	// Delete some text directly after the field
	TheFieldSet->NotifyDeletion(13,1); // pos=13, len=1
		test(TheFieldSet->CharCount()==19);
		test(TheFieldSet->FieldCount()==1);
	inField=TheFieldSet->FindFields(info,9); // pos=9
		test(info.iFieldCountInRange==1);
		test(info.iFirstFieldLen==7);
		test(info.iFirstFieldPos==6);
	// Delete some text before the field
	TheFieldSet->NotifyDeletion(4,2); // pos=4, len=2
		test(TheFieldSet->CharCount()==17);
		test(TheFieldSet->FieldCount()==1);
	inField=TheFieldSet->FindFields(info,7); // pos=7
		test(info.iFieldCountInRange==1);
		test(info.iFirstFieldLen==7);
		test(info.iFirstFieldPos==4);
	// Delete some text overlapping into the field
	TheFieldSet->NotifyDeletion(1,5); // pos=1, len=5
		test(TheFieldSet->CharCount()==12);
		test(TheFieldSet->FieldCount()==1);
	inField=TheFieldSet->FindFields(info,3); // pos=3
		test(info.iFieldCountInRange==1);
		test(info.iFirstFieldLen==5);
		test(info.iFirstFieldPos==1);
	// Delete some text overlapping out of the field
	TheFieldSet->NotifyDeletion(3,4); // pos=3, len=4
		test(TheFieldSet->CharCount()==8);
		test(TheFieldSet->FieldCount()==1);
	inField=TheFieldSet->FindFields(info,2); // pos=2
		test(info.iFieldCountInRange==1);
		test(info.iFirstFieldLen==2);
		test(info.iFirstFieldPos==1);
	// Delete all text, inc field
	TheFieldSet->NotifyDeletion(0,8); // pos=0, len=8
		test(TheFieldSet->CharCount()==0);
		test(TheFieldSet->FieldCount()==0);
		
	//Adding some character & field at the end & then deleting all
		test(TheFieldSet->CharCount()==0);
		test(TheFieldSet->FieldCount()==0);
	// Insert some text
	TheFieldSet->NotifyInsertion(0,4); // pos=0, len=4
		test(TheFieldSet->CharCount()==4);
		test(TheFieldSet->FieldCount()==0);
	// Insert some text into the text
	TheFieldSet->NotifyInsertion(2,7); // pos=2, len=7
		test(TheFieldSet->CharCount()==11);
		test(TheFieldSet->FieldCount()==0);
	//Insert field at the last position
	CTextField* field1 = TheFieldSet->NewFieldL(KDummyFieldUid);
	ret=TheFieldSet->InsertFieldL(5,field1,KDummyFieldUid); // pos=5
	if(ret != KErrNone && field1 !=NULL)
		{
		delete field1;
		field1 = NULL;
		}
		test(ret==KErrNone);
	ret=UpdateField(5);
	//Delete last character
	TheFieldSet->NotifyDeletion(10,1); // pos=10, len=1
		test(TheFieldSet->CharCount()==13);
		test(TheFieldSet->FieldCount()==1);
	//Insert characters at the field position so field moves to 8th pos
	TheFieldSet->NotifyInsertion(5,3); // pos=5, len=3
		test(TheFieldSet->CharCount()==16);
		test(TheFieldSet->FieldCount()==1);
	inField=TheFieldSet->FindFields(info,8); // pos=8
		test(info.iFieldCountInRange==1);
		test(info.iFirstFieldLen==3);
		test(info.iFirstFieldPos==8);
	//Delete last character
	TheFieldSet->NotifyDeletion(15,1); // pos=15, len=1
		test(TheFieldSet->CharCount()==15);
		test(TheFieldSet->FieldCount()==1);
	//Delete out of range character that doesnt exist..
	TheFieldSet->NotifyDeletion(15,1); // pos=15, len=1
		test(TheFieldSet->CharCount()==15);
		test(TheFieldSet->FieldCount()==1);
	//Delete all the characters after the field
	TheFieldSet->NotifyDeletion(11, 4); // pos=11, len=4
		test(TheFieldSet->CharCount()==11);
		test(TheFieldSet->FieldCount()==1);
	//Shorten the field by deleting the last character of the field
	TheFieldSet->NotifyDeletion(10, 1); // pos=10, len=1
		test(TheFieldSet->CharCount()==10);
		test(TheFieldSet->FieldCount()==1);
	inField=TheFieldSet->FindFields(info,8); // pos=0
		test(info.iFieldCountInRange==1);
		test(info.iFirstFieldLen==2);
		test(info.iFirstFieldPos==8);
	//length to be removed is one more than the existing data..DEF095911
	TheFieldSet->NotifyDeletion(0,11); // pos=0, len=11
		test(TheFieldSet->CharCount()==0);
		test(TheFieldSet->FieldCount()==0);
	inField=TheFieldSet->FindFields(info,0); // pos=0
		test(info.iFieldCountInRange==0);
		test(info.iFirstFieldLen==0);
		test(info.iFirstFieldPos==0);

	// Finish up
	TheFieldSet->Reset();
	}