History

setget_dataformat_ut

huili2 committed 12 years ago

Commit e8fdd4c1 parent d0d68428 files · +57 −20Browse files

Showing the changes to test/decoder/DecUT_DecExt.cpp (1 of 8 files). Show all

Unified · Split

test/decoder/DecUT_DecExt.cpp+37−6
@@ -24,8 +24,8 @@ class DecoderInterfaceTest : public ::testing::Test { · 23 unmodified lines
2424 }
2525 //Init members
2626 void Init();
27− //Uninit
28− void Uninit() {}
27+ //Uninit members
28+ void Uninit();
2929 //Mock input data for test
3030 void MockPacketType (const EWelsNalUnitType eNalUnitType);
3131 //Test Initialize/Uninitialize
@@ -72,7 +72,7 @@ void DecoderInterfaceTest::Init() { · 40 unmodified lines
7272 memset (&m_sBufferInfo, 0, sizeof (SBufferInfo));
7373 memset (&m_sDecParam, 0, sizeof (SDecodingParam));
7474 m_sDecParam.pFileNameRestructed = NULL;
75− m_sDecParam.iOutputColorFormat = rand() % 100;
75+ m_sDecParam.eOutputColorFormat = (EVideoFormatType) (rand() % 100);
7676 m_sDecParam.uiCpuLoad = rand() % 100;
7777 m_sDecParam.uiTargetDqLayer = rand() % 100;
7878 m_sDecParam.eEcActiveIdc = (ERROR_CON_IDC) (rand() & 3);
@@ -83,6 +83,19 @@ void DecoderInterfaceTest::Init() { · 4 unmodified lines
8383 m_szBuffer[0] = m_szBuffer[1] = m_szBuffer[2] = 0;
8484 m_szBuffer[3] = 1;
8585 m_iBufLength = 4;
86+ CM_RETURN eRet = (CM_RETURN) m_pDec->Initialize (&m_sDecParam);
87+ ASSERT_EQ (eRet, cmResultSuccess);
88+}
89+
90+void DecoderInterfaceTest::Uninit() {
91+ if (m_pDec) {
92+ CM_RETURN eRet = (CM_RETURN) m_pDec->Uninitialize();
93+ ASSERT_EQ (eRet, cmResultSuccess);
94+ }
95+ memset (&m_sDecParam, 0, sizeof (SDecodingParam));
96+ memset (&m_sBufferInfo, 0, sizeof (SBufferInfo));
97+ m_pData[0] = m_pData[1] = m_pData[2] = NULL;
98+ m_iBufLength = 0;
8699 }
87100
88101 //Mock input data for test
@@ -128,7 +141,7 @@ void DecoderInterfaceTest::TestInitUninit() { · 39 unmodified lines
128141 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_DATAFORMAT, &iOutput);
129142 EXPECT_EQ (eRet, cmInitExpected);
130143 //Initialize first, can get input color format
131− m_sDecParam.iOutputColorFormat = 20; //just for test
144+ m_sDecParam.eOutputColorFormat = (EVideoFormatType) 20; //just for test
132145 m_pDec->Initialize (&m_sDecParam);
133146 eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_DATAFORMAT, &iOutput);
134147 EXPECT_EQ (eRet, cmResultSuccess);
@@ -144,7 +157,21 @@ void DecoderInterfaceTest::TestInitUninit() { · 9 unmodified lines
144157
145158 //DECODER_OPTION_DATAFORMAT
146159 void DecoderInterfaceTest::TestDataFormat() {
147− //TODO
160+ int iTmp = rand();
161+ int iOut;
162+ CM_RETURN eRet;
163+
164+ //invalid input
165+ eRet = (CM_RETURN) m_pDec->SetOption (DECODER_OPTION_DATAFORMAT, NULL);
166+ EXPECT_EQ (eRet, cmInitParaError);
167+
168+ //valid input
169+ eRet = (CM_RETURN) m_pDec->SetOption (DECODER_OPTION_DATAFORMAT, &iTmp);
170+ EXPECT_EQ (eRet, cmResultSuccess);
171+ eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_DATAFORMAT, &iOut);
172+ EXPECT_EQ (eRet, cmResultSuccess);
173+
174+ EXPECT_EQ (iOut, (int32_t) videoFormatI420);
148175 }
149176
150177 //DECODER_OPTION_END_OF_STREAM
@@ -204,10 +231,12 @@ void DecoderInterfaceTest::TestTraceCallbackContext() { · 53 unmodified lines
204231
205232 //TEST here for whole tests
206233 TEST_F (DecoderInterfaceTest, DecoderInterfaceAll) {
207− Init();
208234
209235 //Initialize Uninitialize
210236 TestInitUninit();
237+
238+ //AfterInitialize is OK, do the following tests
239+ Init();
211240 //DECODER_OPTION_DATAFORMAT
212241 TestDataFormat();
213242 //DECODER_OPTION_END_OF_STREAM
@@ -233,6 +262,8 @@ TEST_F (DecoderInterfaceTest, DecoderInterfaceAll) { · 19 unmodified lines
233262 //DECODER_OPTION_TRACE_CALLBACK_CONTEXT
234263 TestTraceCallbackContext();
235264
265+ //uninitialize
266+ Uninit();
236267 }
237268
238269

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t