コード例 #1
0
LOCAL_C void TestAssignmentOperatorL()
{
	test.Next (_L ("@SYMTestCaseID:SYSLIB-EUSERHL-UT-4007"));	

	test.Next(_L("Assignment operator"));

	TBUF tdes(_TS("Modifiable descriptor"));
	TBUFC tdesc(_TS("Non-modifiable descriptor"));

	LSTRING lStr(32);
	LSTRING lStr2(32);
	lStr2.CopyL(_TS("Buffer descriptor"), 17);

	lStr = tdesc;	test(lStr == tdesc);
	lStr = tdes;	test(lStr == tdes);
	lStr = lStr2;	test(lStr == lStr2);
	
	LSTRING lStr3(tdes);
	lStr = lStr3.PtrZL(); test(lStr == tdes);
	
	test.Next(_L("operator=(char/wchar_t* aCharStr) method"));
	LSTRING lStr4(_CS("123456"));
	LSTRING lStr5 = _CS("123456");
	test(lStr4 == lStr5);
	
	LSTRING lStr6;
	lStr6 =  _CS("123456");
	test(lStr4 == lStr6);
	}
コード例 #2
0
LOCAL_C void TestAssign(LSTRING*)
{

	test.Next (_L ("@SYMTestCaseID:SYSLIB-EUSERHL-UT-4002"));
	
	TBUF des (_TS("123456"));
	LSTRING lStr2(des);
	TTEXT* heap = NULL;
	RBUF buf;

	test.Next(_L("Assign(const LString_& aLString) method"));

	LSTRING lStr;
	lStr.Assign(lStr2);
	// the assignment clears lStr2 so the two strings should be unequal
	test(lStr != lStr2);

	test.Next(_L("Assign(TUint* aHeapCell, TInt aLength, TInt aMaxLength ) method"));

	heap = (TTEXT*)User::Alloc(24*(TInt)sizeof(TTEXT)); //Allocate 48 bytes for 24 long LString16
	lStr.Assign(heap, 12,24);
	test(lStr.Length() == 12);		
	test(lStr.MaxLength() >= 24);		

	heap = NULL;
	lStr.Assign(heap, 0,0);
	test(lStr.Length() == 0);		
	test(lStr.MaxLength() == 0);		
	
	test.Next(_L("Assign(TUint* aHeapCell, TInt aMaxLength ) method"));
	
	heap = (TTEXT*)User::Alloc(24*(TInt)sizeof(TTEXT)); //Allocate 48 bytes for 24 long LString16
	lStr.Assign(heap, 24);
	test(lStr.Length() == 0);		
	test(lStr.MaxLength() >= 24);		

	test.Next(_L("Assign(HBufC_* aHBuf) method"));

	HBUF* hBuf = HBUF::NewMax(11);
	lStr.Assign(hBuf);			//Create LString as EBufCPtr type
	test(lStr.Length() == 11);
	test(lStr.MaxLength() >= 11); //There could me more allocated memory - see HBufC8::Des()
	
	HBUF* hBuf2 = HBUF::NewMax(5);
	lStr = hBuf2;			//Create LString as EBufCPtr type
	test(lStr.Length() == 5);
	test(lStr.MaxLength() >= 5); //There could me more allocated memory - see HBufC8::Des()

	test.Next(_L("Assign(const RBuf_& aRBuf) method"));

	buf.Create(des);
	lStr.Assign(buf);
	
	// the assignment trasnfers buf so the two strings should be equal
	test(lStr == des);
	test(lStr != buf);
	
}
コード例 #3
0
ファイル: _main.cpp プロジェクト: Joelone/MLEA
LRESULT CALLBACK WndProc(
	HWND hWnd,
	UINT Msg,
	WPARAM wParam,
	LPARAM lParam )
{
	LPNMHDR hdr;
	TVITEM tvit;
	INITLSTR();
	TBBUTTON tbButton={LOWORD(lParam)-160, 0,  TBSTATE_ENABLED, BTNS_SEP, 0L, 0};
	switch(Msg)
	{
		case WM_DESTROY:
			App.TreeViewDelFile(0);
			PostQuitMessage(0);
			break;
		case WM_SIZE:
			MoveWindow(App.hTreeView,0,44,LOWORD(lParam),HIWORD(lParam)-44,TRUE);
			SendMessage(App.hToolBar,TB_AUTOSIZE,0,0);
			SendMessage(App.hToolBar,TB_DELETEBUTTON,0,0);
			SendMessage(App.hToolBar,TB_INSERTBUTTON,0,(LPARAM)&tbButton);
			SendMessage(App.hToolBar,TB_AUTOSIZE,0,0);
			break;
		case WM_COMMAND:
			if ((HWND)lParam==App.hToolBar)
			{
				switch (wParam)
				{
				case 123: //destroy button
					switch (DialogBoxW(App.hIns,MAKEINTRESOURCE(IDD_RESETDEL),hWnd,(DLGPROC)DlgResetProc))
					{
					case IDRESET:
					App.TreeViewDelFile(0);
						break;
					case IDRESETDEL:
						tvit.hItem = TreeView_GetSelection(App.hTreeView);
						if (tvit.hItem!=0)
						{
							App.TreeViewDelFile(tvit.hItem);
						}
						else
						{
							MessageBox(hWnd,lStr(UNSELECT),lStr2(UERROR),MB_OK);
						}
						break;
					}
					
					break;
				case 124: //activate monitoring button
					if (!App.readyMon)
					{
						ShowWindow(App.hWnd,SW_MINIMIZE);
						ShowWindow(App.hWnd,SW_HIDE);
						App.readyMon=false;
						_beginthreadex(NULL,0,ThreadPrepareMon,(void *)123,0,NULL);
					}
					break;
				case 125:
					if (SendMessage(App.hToolBar,TB_ISBUTTONCHECKED,125,0))
					{	SetWindowPos(hWnd,HWND_TOPMOST,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);	}
					else
					{	SetWindowPos(hWnd,HWND_NOTOPMOST,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE);	}
					break;
				case 126:
					DialogBoxW(App.hIns,MAKEINTRESOURCE(IDD_DIALOGABOUT),hWnd,(DLGPROC)DlgAboutProc);
					break;
				}
			}
			break;
		case WM_NOTIFY:
			hdr = (LPNMHDR) lParam;
			if (hdr->code==NM_DBLCLK)
			{
				tvit.mask = TVIF_PARAM;
				tvit.hItem = TreeView_GetSelection(App.hTreeView);
				TreeView_GetItem(App.hTreeView,&tvit);
				switch (tvit.lParam)
				{
					case 10://Project
					_beginthreadex(NULL,0,ThreadScanFolder,(void *)TreeView_GetSelection(App.hTreeView),0,NULL);
					break;
					case 20://Category of log message
						_beginthreadex(NULL,0,ThreadScanFile,(void *)TreeView_GetSelection(App.hTreeView),0,NULL);
					break;
					case 30:
						_beginthreadex(NULL,0,LogWindow,(void *)TreeView_GetSelection(App.hTreeView),0,NULL);
					break;
				}
			}
			if (hdr->code==NM_CLICK)
			{
				App.alert=false;
			}
			
			if (hdr->code==TTN_GETDISPINFO) 
			{ 
				LPTOOLTIPTEXT lpttt; 
				lpttt = (LPTOOLTIPTEXT) lParam; 
				lpttt->hinst = App.hIns; 
				// Specify the resource identifier of the descriptive 
				// text for the given button. 
				UINT idButton = lpttt->hdr.idFrom; 
				switch (idButton) 
				{ 
				    case 123: 
				        lpttt->lpszText = MAKEINTRESOURCE(IDS_STRING_UDESTOY); 
				        break; 
				    case 124: 
						lpttt->lpszText = MAKEINTRESOURCE(IDS_STRING_UMON); 
				        break; 
				    case 125: 
				        lpttt->lpszText = MAKEINTRESOURCE(IDS_STRING_UTOP); 
				        break;
					case 126: 
				        lpttt->lpszText = MAKEINTRESOURCE(IDS_STRING_UABOUTBUTTON); 
				        break;
				} 
			} 
			break;
		case WM_TRAYMSG:
			switch ((UINT)lParam)
			{
			case WM_LBUTTONUP:
				if (App.readyMon)
				{
					App.readyMon=false;
					ShowWindow(App.hWnd,SW_SHOW);
					ShowWindow(App.hWnd,SW_RESTORE);
					SetForegroundWindow(App.hTreeView);
					App.DeleteTrayIcon();
				}
				
				break;
			}
			break;

		default:
			return DefWindowProc(hWnd,Msg,wParam,lParam);
	}
	return (0);
}
コード例 #4
0
LOCAL_C void TestConstructors(LSTRING*)
{
	
	test.Next (_L ("@SYMTestCaseID:SYSLIB-EUSERHL-UT-4001"));
	
	test.Next(_L("LString_(const TDesC& aDes) constructor"));
	const TBUF des (_TS("123456"));
	const LSTRING lStr(des);
	test(lStr.Length() == 6);
	test(lStr.MaxLength() >= 6);
	
	test.Next(_L("LString_(const LString16& aDes) constructor"));
	LSTRING lStr1(lStr);
	test(lStr1.Length() == 6);
	test(lStr1.MaxLength() >= 6);
	
	test.Next(_L("LString_(const TUInt16* aString) constructor"));
	LSTRING lStr2(lStr1.PtrZL());
	test(lStr2.Length() == 6);
	test(lStr2.MaxLength() >= 6);
	
	test.Next(_L("LString_(HBufC_* aHBuf) constructor"));

	HBUF* hBuf = HBUF::NewMax(12);	//Create LString as EBufCPtr
	LSTRING lStr3(hBuf);
	test(lStr3.Length() == 12);
	test(lStr3.MaxLength() >= 12);

	hBuf = HBUF::NewMax(0);
	LSTRING lStr4(hBuf);			//The length of aHBuf is zero
	test(lStr4.Length() == 0);

	hBuf = NULL;				//aHBuf is NULL
	LSTRING lStr5((HBUF*)hBuf);
	test(lStr5.Length() == 0);
	test(lStr5.MaxLength() == 0);
	
	test.Next(_L("LString_(TUInt16* aHeapCell, TInt aLength, TInt aMaxLength) constructor"));
	TTEXT* heap = NULL;

	heap = (TTEXT*)User::Alloc(24*(TInt)sizeof(TTEXT)); //Allocate 48 bytes for 24 long LString16
	LSTRING lStr6(heap, 12,24);
	test(lStr6.Length() == 12);		
	test(lStr6.MaxLength() >= 24);		

	test.Next(_L("LString_(TUint* aHeapCell, TInt aMaxLength ) method"));
	
	heap = (TTEXT*)User::Alloc(24*(TInt)sizeof(TTEXT)); //Allocate 48 bytes for 24 long LString16
	LSTRING lStr7(heap, 24);
	test(lStr7.Length() == 0);		
	test(lStr7.MaxLength() >= 24);		
	
	test.Next(_L("LString_(char/wchar_t * aCharStr) constructor"));
	
	LSTRING lStr8(_CS("0123456789"));
	test(lStr8.Length() == 10);		
	test(lStr8.MaxLength() >= 10);
	
	LSTRING lStr9(_CS("01234567890"));
	test(lStr9.Length() == 11);		
	test(lStr9.MaxLength() >= 11);
}