23 #include "t_camera_bitmap.h" |
23 #include "t_camera_bitmap.h" |
24 #include "d_mmcsc.h" |
24 #include "d_mmcsc.h" |
25 |
25 |
26 _LIT(KTstLddFileName,"D_MMCSC.LDD"); |
26 _LIT(KTstLddFileName,"D_MMCSC.LDD"); |
27 _LIT(KCamLddFileName,"ECAMERASC.LDD"); |
27 _LIT(KCamLddFileName,"ECAMERASC.LDD"); |
|
28 |
|
29 #ifdef __WINSCW__ |
|
30 _LIT(KCamPddFileName,"_TEMPLATE_CAMERASC.PDD"); |
|
31 #else |
28 _LIT(KCamPddFileName,"CAMERASC.PDD"); |
32 _LIT(KCamPddFileName,"CAMERASC.PDD"); |
|
33 #endif |
|
34 |
|
35 |
29 _LIT(KCamFreePddExtension,".*"); |
36 _LIT(KCamFreePddExtension,".*"); |
30 |
37 |
31 _LIT(KFrameSize, "%dx%d"); |
38 _LIT(KFrameSize, "%dx%d"); |
32 _LIT(KSensor, "d:\\Sensor_"); |
39 _LIT(KSensor, "d:\\Sensor_"); |
33 _LIT(KUnderscore, "_"); |
40 _LIT(KUnderscore, "_"); |
98 thread.Close(); |
106 thread.Close(); |
99 break; |
107 break; |
100 } |
108 } |
101 case ESecThreadReuseHandle: |
109 case ESecThreadReuseHandle: |
102 { |
110 { |
103 Test.Next(_L("Re-use channel test")); |
111 stest.Next(_L("Re-use channel test")); |
104 RDevCameraSc* camPtr=(RDevCameraSc*)sti.iDrvHandle; |
112 RDevCameraSc* camPtr=(RDevCameraSc*)sti.iDrvHandle; |
105 TCameraConfigV02Buf camConfBuf; |
113 TCameraConfigV02Buf camConfBuf; |
106 camPtr->GetCamConfig(ECamCaptureModeImage, camConfBuf); // This should cause a panic. |
114 camPtr->GetCamConfig(ECamCaptureModeImage, camConfBuf); // This should cause a panic. |
107 break; |
115 break; |
108 } |
116 } |
163 |
171 |
164 TDynamicRange &driverRangeColorEffect = ((TCameraCapsV02*)(driverCopy.Ptr()))->iDynamicRange[ECamAttributeColorEffect]; |
172 TDynamicRange &driverRangeColorEffect = ((TCameraCapsV02*)(driverCopy.Ptr()))->iDynamicRange[ECamAttributeColorEffect]; |
165 TDynamicRange &clientRangeColorEffect = ((TCameraCapsV02*)(clientCopy.Ptr()))->iDynamicRange[ECamAttributeColorEffect]; |
173 TDynamicRange &clientRangeColorEffect = ((TCameraCapsV02*)(clientCopy.Ptr()))->iDynamicRange[ECamAttributeColorEffect]; |
166 |
174 |
167 aTest(driverRangeColorEffect.iMin == 0); |
175 aTest(driverRangeColorEffect.iMin == 0); |
168 aTest(driverRangeColorEffect.iMax == 7); |
176 aTest(driverRangeColorEffect.iMax == 7); // TBC::OV3640 set to 7, template driver set to 0x0040 (enum) |
169 aTest(driverRangeColorEffect.iMin == clientRangeColorEffect.iMin); |
177 aTest(driverRangeColorEffect.iMin == clientRangeColorEffect.iMin); |
170 aTest(driverRangeColorEffect.iMax == clientRangeColorEffect.iMax); |
178 aTest(driverRangeColorEffect.iMax == clientRangeColorEffect.iMax); |
171 |
179 |
172 aTest.Next(_L("Test for invalid Min range.")); |
180 aTest.Next(_L("Test for invalid Min range.")); |
173 aTest(aCam.SetDynamicAttribute(ECamAttributeBrightness, driverRangeBrightness.iMin-1)==KErrArgument); |
181 aTest(aCam.SetDynamicAttribute(ECamAttributeBrightness, driverRangeBrightness.iMin-1)==KErrArgument); |
174 aTest(aCam.SetDynamicAttribute(ECamAttributeContrast, driverRangeContrast.iMin-1)==KErrArgument); |
182 aTest(aCam.SetDynamicAttribute(ECamAttributeContrast, driverRangeContrast.iMin-1)==KErrArgument); |
175 aTest(aCam.SetDynamicAttribute(ECamAttributeColorEffect, driverRangeColorEffect.iMin-1)==KErrNotSupported); |
183 aTest(aCam.SetDynamicAttribute(ECamAttributeColorEffect, driverRangeColorEffect.iMin-1)==KErrArgument); |
176 |
184 |
177 aTest.Next(_L("Test for invalid Max range.")); |
185 aTest.Next(_L("Test for invalid Max range.")); |
178 aTest(aCam.SetDynamicAttribute(ECamAttributeBrightness, driverRangeBrightness.iMax+1)==KErrArgument); |
186 aTest(aCam.SetDynamicAttribute(ECamAttributeBrightness, driverRangeBrightness.iMax+1)==KErrArgument); |
179 aTest(aCam.SetDynamicAttribute(ECamAttributeContrast, driverRangeContrast.iMax+1)==KErrArgument); |
187 aTest(aCam.SetDynamicAttribute(ECamAttributeContrast, driverRangeContrast.iMax+1)==KErrArgument); |
180 aTest(aCam.SetDynamicAttribute(ECamAttributeColorEffect, driverRangeColorEffect.iMax+1)==KErrNotSupported); |
188 aTest(aCam.SetDynamicAttribute(ECamAttributeColorEffect, driverRangeColorEffect.iMax+1)==KErrArgument); |
181 |
189 |
182 aTest.Next(_L("Test all valid settings as reported by range - Brightness")); |
190 aTest.Next(_L("Test all valid settings as reported by range - Brightness")); |
183 for (TUint i=driverRangeBrightness.iMin; i <= driverRangeBrightness.iMax; ++i) |
191 for (TUint i=driverRangeBrightness.iMin; i <= driverRangeBrightness.iMax; ++i) |
184 { |
192 { |
185 aTest(aCam.SetDynamicAttribute(ECamAttributeBrightness, i)==KErrNone); |
193 aTest(aCam.SetDynamicAttribute(ECamAttributeBrightness, i)==KErrNone); |
456 |
464 |
457 aTest.Next(_L("Open a channel from the 2nd thread having closed the 1st")); |
465 aTest.Next(_L("Open a channel from the 2nd thread having closed the 1st")); |
458 cam.Close(); // Close the 1st channel |
466 cam.Close(); // Close the 1st channel |
459 sti.iTestId=ESecThreadTestOpen; |
467 sti.iTestId=ESecThreadTestOpen; |
460 sti.iExpectedRetVal=KErrNone; |
468 sti.iExpectedRetVal=KErrNone; |
461 r=thread.Create(_L("Thread"),secondaryThread,KDefaultStackSize,KHeapSize,KHeapSize,&sti); |
469 r=thread.Create(_L("Thread02"),secondaryThread,KDefaultStackSize,KHeapSize,KHeapSize,&sti); |
462 Test(r==KErrNone); |
470 Test(r==KErrNone); |
463 thread.Logon(stat); |
471 thread.Logon(stat); |
464 thread.Resume(); |
472 thread.Resume(); |
465 User::WaitForRequest(stat); |
473 User::WaitForRequest(stat); |
466 Test(stat.Int()==KErrNone); |
474 Test(stat.Int()==KErrNone); |
474 sti.iTestId=ESecThreadTestDuplicateHandle; |
482 sti.iTestId=ESecThreadTestDuplicateHandle; |
475 sti.iExpectedRetVal=KErrAccessDenied; |
483 sti.iExpectedRetVal=KErrAccessDenied; |
476 sti.iThreadId=RThread().Id(); // Get the ID of this thread |
484 sti.iThreadId=RThread().Id(); // Get the ID of this thread |
477 sti.iDrvHandle=cam.Handle(); // Pass the channel handle |
485 sti.iDrvHandle=cam.Handle(); // Pass the channel handle |
478 |
486 |
479 r=thread.Create(_L("Thread"),secondaryThread,KDefaultStackSize,KHeapSize,KHeapSize,&sti); // Create secondary thread |
487 r=thread.Create(_L("Thread03"),secondaryThread,KDefaultStackSize,KHeapSize,KHeapSize,&sti); // Create secondary thread |
480 Test(r==KErrNone); |
488 Test(r==KErrNone); |
481 thread.Logon(stat); |
489 thread.Logon(stat); |
482 thread.Resume(); |
490 thread.Resume(); |
483 User::WaitForRequest(stat); |
491 User::WaitForRequest(stat); |
484 Test(stat.Int()==KErrNone); |
492 Test(stat.Int()==KErrNone); |
487 User::After(10000); // Wait 10ms |
495 User::After(10000); // Wait 10ms |
488 |
496 |
489 aTest.Next(_L("Re-use the same channel from 2nd thread")); |
497 aTest.Next(_L("Re-use the same channel from 2nd thread")); |
490 sti.iTestId=ESecThreadReuseHandle; |
498 sti.iTestId=ESecThreadReuseHandle; |
491 sti.iDrvHandle=(TInt)&cam; // Pass a pointer to the channel |
499 sti.iDrvHandle=(TInt)&cam; // Pass a pointer to the channel |
492 r=thread.Create(_L("Thread"),secondaryThread,KDefaultStackSize,KHeapSize,KHeapSize,&sti); // Create secondary thread |
500 r=thread.Create(_L("Thread04"),secondaryThread,KDefaultStackSize,KHeapSize,KHeapSize,&sti); // Create secondary thread |
493 Test(r==KErrNone); |
501 Test(r==KErrNone); |
494 thread.Logon(stat); |
502 thread.Logon(stat); |
495 thread.Resume(); |
503 thread.Resume(); |
496 User::WaitForRequest(stat); |
504 User::WaitForRequest(stat); |
497 TExitCategoryName exitCategoryName = thread.ExitCategory(); |
505 TExitCategoryName exitCategoryName = thread.ExitCategory(); |
679 aTest(retId>=0); |
687 aTest(retId>=0); |
680 aCam.BufferIdToOffset(aCaptureMode,retId,retOffset); |
688 aCam.BufferIdToOffset(aCaptureMode,retId,retOffset); |
681 aTest(retOffset>=0); |
689 aTest(retOffset>=0); |
682 imgBase=chunkVideo.Base()+retOffset; |
690 imgBase=chunkVideo.Base()+retOffset; |
683 r=dispHand.Process(imgBase); |
691 r=dispHand.Process(imgBase); |
|
692 |
|
693 #ifdef __WINSCW__ |
|
694 aTest(r==KErrNotSupported); |
|
695 #else |
684 aTest(r==KErrNone); |
696 aTest(r==KErrNone); |
|
697 #endif |
|
698 |
685 User::After(333000); // 0.33sec |
699 User::After(333000); // 0.33sec |
686 } |
700 } |
687 } |
701 } |
688 |
702 |
689 aTest.Next(_L("Free the buffers")); |
703 aTest.Next(_L("Free the buffers")); |
748 aTest(retOffset>=0); |
762 aTest(retOffset>=0); |
749 imgBase=chunkVideo.Base()+retOffset; |
763 imgBase=chunkVideo.Base()+retOffset; |
750 if (aPixelFormat.iPixelFormat!=EUidPixelFormatJPEG && aPixelFormat.iPixelFormat!=EUidPixelFormatSpeedTaggedJPEG) |
764 if (aPixelFormat.iPixelFormat!=EUidPixelFormatJPEG && aPixelFormat.iPixelFormat!=EUidPixelFormatSpeedTaggedJPEG) |
751 { |
765 { |
752 r=dispHand.Process(imgBase); |
766 r=dispHand.Process(imgBase); |
|
767 |
|
768 #ifdef __WINSCW__ |
|
769 aTest(r==KErrNotSupported); |
|
770 #else |
753 aTest(r==KErrNone); |
771 aTest(r==KErrNone); |
|
772 #endif |
|
773 |
754 } |
774 } |
755 r=aCam.ReleaseBuffer(retId); |
775 r=aCam.ReleaseBuffer(retId); |
756 aTest(r==KErrNone); |
776 aTest(r==KErrNone); |
757 aCam.NotifyNewImage(rs[0]); |
777 aCam.NotifyNewImage(rs[0]); |
758 } |
778 } |
764 aTest(retOffset>=0); |
784 aTest(retOffset>=0); |
765 imgBase=chunkVideo.Base()+retOffset; |
785 imgBase=chunkVideo.Base()+retOffset; |
766 if (aPixelFormat.iPixelFormat!=EUidPixelFormatJPEG && aPixelFormat.iPixelFormat!=EUidPixelFormatSpeedTaggedJPEG) |
786 if (aPixelFormat.iPixelFormat!=EUidPixelFormatJPEG && aPixelFormat.iPixelFormat!=EUidPixelFormatSpeedTaggedJPEG) |
767 { |
787 { |
768 r=dispHand.Process(imgBase); |
788 r=dispHand.Process(imgBase); |
|
789 |
|
790 #ifdef __WINSCW__ |
|
791 aTest(r==KErrNotSupported); |
|
792 #else |
769 aTest(r==KErrNone); |
793 aTest(r==KErrNone); |
|
794 #endif |
|
795 |
770 } |
796 } |
771 r=aCam.ReleaseBuffer(retId); |
797 r=aCam.ReleaseBuffer(retId); |
772 aTest(r==KErrNone); |
798 aTest(r==KErrNone); |
773 aCam.NotifyNewImage(rs[1]); |
799 aCam.NotifyNewImage(rs[1]); |
774 } |
800 } |
860 |
886 |
861 if (aPixelFormat.iPixelFormat!=EUidPixelFormatJPEG && aPixelFormat.iPixelFormat!=EUidPixelFormatSpeedTaggedJPEG) |
887 if (aPixelFormat.iPixelFormat!=EUidPixelFormatJPEG && aPixelFormat.iPixelFormat!=EUidPixelFormatSpeedTaggedJPEG) |
862 { |
888 { |
863 // Display the image received for 1s |
889 // Display the image received for 1s |
864 r=dispHand.Process(imgBase); |
890 r=dispHand.Process(imgBase); |
865 aTest(r==KErrNone); |
891 |
|
892 #ifdef __WINSCW__ |
|
893 aTest(r==KErrNotSupported); |
|
894 #else |
|
895 aTest(r==KErrNone); |
|
896 #endif |
|
897 |
866 User::After(1000000); // 1 sec |
898 User::After(1000000); // 1 sec |
867 } |
899 } |
868 |
900 |
869 // Save the to do MMC card with a filename to indicate its size. If no MMC card is present |
901 // Save the to do MMC card with a filename to indicate its size. If no MMC card is present |
870 // then we will just display a warning rather than fail as this is an optional manual step |
902 // then we will just display a warning rather than fail as this is an optional manual step |
924 if (aPixelFormat.iPixelFormat!=EUidPixelFormatJPEG && aPixelFormat.iPixelFormat!=EUidPixelFormatSpeedTaggedJPEG) |
956 if (aPixelFormat.iPixelFormat!=EUidPixelFormatJPEG && aPixelFormat.iPixelFormat!=EUidPixelFormatSpeedTaggedJPEG) |
925 { |
957 { |
926 // Display the image received for 1s |
958 // Display the image received for 1s |
927 imgBase=chunkImage.Base()+retOffset; |
959 imgBase=chunkImage.Base()+retOffset; |
928 r=dispHand.Process(imgBase); |
960 r=dispHand.Process(imgBase); |
929 aTest(r==KErrNone); |
961 |
|
962 #ifdef __WINSCW__ |
|
963 aTest(r==KErrNotSupported); |
|
964 #else |
|
965 aTest(r==KErrNone); |
|
966 #endif |
|
967 |
930 User::After(1000000); // 1 sec |
968 User::After(1000000); // 1 sec |
931 } |
969 } |
932 |
970 |
933 r=aCam.ReleaseBuffer(retId); |
971 r=aCam.ReleaseBuffer(retId); |
934 aTest(r==KErrNone); |
972 aTest(r==KErrNone); |
943 if (aPixelFormat.iPixelFormat!=EUidPixelFormatJPEG && aPixelFormat.iPixelFormat!=EUidPixelFormatSpeedTaggedJPEG) |
981 if (aPixelFormat.iPixelFormat!=EUidPixelFormatJPEG && aPixelFormat.iPixelFormat!=EUidPixelFormatSpeedTaggedJPEG) |
944 { |
982 { |
945 // Display the image received for 1s |
983 // Display the image received for 1s |
946 imgBase=chunkImage.Base()+retOffset; |
984 imgBase=chunkImage.Base()+retOffset; |
947 r=dispHand.Process(imgBase); |
985 r=dispHand.Process(imgBase); |
948 aTest(r==KErrNone); |
986 |
|
987 #ifdef __WINSCW__ |
|
988 aTest(r==KErrNotSupported); |
|
989 #else |
|
990 aTest(r==KErrNone); |
|
991 #endif |
|
992 |
949 User::After(1000000); // 1 sec |
993 User::After(1000000); // 1 sec |
950 } |
994 } |
951 |
995 |
952 r=aCam.ReleaseBuffer(retId); |
996 r=aCam.ReleaseBuffer(retId); |
953 aTest(r==KErrNone); |
997 aTest(r==KErrNone); |
966 if (aPixelFormat.iPixelFormat!=EUidPixelFormatJPEG && aPixelFormat.iPixelFormat!=EUidPixelFormatSpeedTaggedJPEG) |
1010 if (aPixelFormat.iPixelFormat!=EUidPixelFormatJPEG && aPixelFormat.iPixelFormat!=EUidPixelFormatSpeedTaggedJPEG) |
967 { |
1011 { |
968 // Display the image received for 1s |
1012 // Display the image received for 1s |
969 imgBase=chunkImage.Base()+retOffset; |
1013 imgBase=chunkImage.Base()+retOffset; |
970 r=dispHand.Process(imgBase); |
1014 r=dispHand.Process(imgBase); |
971 aTest(r==KErrNone); |
1015 |
|
1016 #ifdef __WINSCW__ |
|
1017 aTest(r==KErrNotSupported); |
|
1018 #else |
|
1019 aTest(r==KErrNone); |
|
1020 #endif |
|
1021 |
972 User::After(1000000); // 1 sec |
1022 User::After(1000000); // 1 sec |
973 } |
1023 } |
974 } |
1024 } |
975 |
1025 |
976 r=aCam.ReleaseBuffer(retId); |
1026 r=aCam.ReleaseBuffer(retId); |