宝马测试(C++实现)


     测试目的:对编辑器放大,缩小性能测试。

     测试资源:一匹宝马。 

     测试结果:良好。






      实现方法:通过调用本地保存的宝马文件,逐字逐行的显示在编辑器中,并放大,缩小。对不同的符号进行上色处理。


1. 宝马文件

     

       

{/*LOOKBMW


                               _(\_/) 
                             ,((((^`
                            ((((  (6  
                          ,((((( ,    
      ,,,_              ,(((((  /"._  ,`,
     ((((\ ,...       ,((((   /    `-.-'
     )))  ;'    `"'"'""((((   (      
    (((  /            (((      
     )) |                      |
    ((  |        .       '     |
    ))       _ '      `t   ,.')
    (   |   y;- -,-""'"-.   /  
    )   / ./  ) /         `  
       |./   ( (           / /'
       ||     \          //'|
       ||      \       _//'||
       ||       ))     |_/  ||
       \_     |_/          ||
       `'"                  \_
                            `'" 
$—LOOKBMW*/}




2. C++实现


 A 先载入BMW文件,在逐字逐行显示在编辑器中。

CStdioFile LookBmwFile;
	CString bwmFilePath = Pack::GetConfigIniFile(_T("GlbBmwFilePath"));
	if(!LookBmwFile.Open(bwmFilePath, CFile::modeRead | CFile::typeText))
	{
		MessageBox(_T("Loading files Error " + bwmFilePath + ", please reinstall the software..."));
	}

	CString strBmwTxt;
	BOOL BwmTxtStart = false;
	while(LookBmwFile.ReadString(strBmwTxt))
	{
		if(BwmTxtStart)
		{
			if(strBmwTxt == _T("$—LOOKBMW*/}")){
				break;
			}

			CString str;
			for(int i=0; i<strBmwTxt.GetLength(); i++)
			{
				str = (strBmwTxt[i]);
				SendMessages(SCI_ADDTEXT, 1, (LPARAM)(LPCSTR)str);
				UpdateWindow();		
				Sleep(15);
			}
			str = _T("
");
			SendMessages(SCI_ADDTEXT, 1, (LPARAM)(LPCSTR)str);
		}

		if(strBmwTxt.Trim() == _T("{/*LOOKBMW"))
		{
			BwmTxtStart = TRUE;
		}
	}

	LookBmwFile.Close();


B 设定放大的倍数,和缩小的倍数,循环3次。

int j=3;
	int i=5;
	while(j--)
	{
		while(i--){
			SendMessages(SCI_ZOOMIN, 0, 0);
			UpdateWindow();
			Sleep(70);
		}
		i=15;
		while(i--){
			SendMessages(SCI_ZOOMOUT, 0, 0);
			UpdateWindow();
			Sleep(70);
		}
		i=15;
	}

	i=10;
	while(i--){
		SendMessages(SCI_ZOOMIN, 0, 0);
		UpdateWindow();
		Sleep(70);
	}



文/yanxin8原创,获取更多信息请访问http://yanxin8.com/220.html


原文地址:https://www.cnblogs.com/iplus/p/4467103.html