* test_registratura_form.prg * Test headless: incarcarea listei documentelor (viz_registratura) + instantierea * containerului ct_registratura pe un form ascuns (verifica clase/cursoare/grid). * Rulare: vfp9.exe -A -T "D:\ROA\ROAREGISTRATURA\Teste\test_registratura_form.prg" * Log: D:\ROA\ROAREGISTRATURA\Teste\log_test_form.txt SET SAFETY OFF SET TALK OFF * mock amessagebox PRIMUL in lista de proceduri (la nume duplicat castiga PRIMUL - testare-ui-vfp.md cap. j) SET PROCEDURE TO D:\ROA\ROAREGISTRATURA\COMUN\utile\Teste\mock_amessagebox.prg ADDITIVE PUBLIC gnMockRaspuns gnMockRaspuns = 6 PUBLIC gcTestLog gcTestLog = 'D:\ROA\ROAREGISTRATURA\Teste\log_test_form.txt' STRTOFILE('=== test_registratura_form ' + TTOC(DATETIME()) + CHR(13)+CHR(10), gcTestLog) ON ERROR DO tlog WITH '*** EROARE ' + TRANSFORM(ERROR()) + ': ' + MESSAGE() + ; ' | ' + MESSAGE(1) + ' | prg=' + PROGRAM() + ' lin=' + TRANSFORM(LINENO()) DO tlog WITH 'Init mediu...' DO D:\ROA\ROAREGISTRATURA\Teste\test_init_env_registratura.prg IF TYPE('gnHandle') # 'N' OR gnHandle <= 0 DO tlog WITH 'ESEC conectare (gnHandle=' + TRANSFORM(IIF(TYPE('gnHandle')='N',gnHandle,-999)) + ') - STOP' DO tfinal ENDIF DO tlog WITH 'Conectat, gnHandle=' + TRANSFORM(gnHandle) + ' schema=' + gcS * 1) incarcarea cursorului listei DO tlog WITH '--- Test 1: viz_registratura' DO viz_registratura IN oproceduri_roaregistratura.prg IF USED('cRegistratura') SELECT cRegistratura DO tlog WITH 'OK cursor cRegistratura, inregistrari=' + TRANSFORM(RECCOUNT()) IF RECCOUNT() > 0 GO BOTTOM DO tlog WITH 'Ultimul document: id_reg=' + TRANSFORM(NVL(id_reg,0)) + ; ' nr_intern=' + TRANSFORM(NVL(numar_intern,'')) + ; ' data_intern=' + TRANSFORM(data_intern) + ; ' partener=' + TRANSFORM(NVL(denumire,'')) GO TOP SCATTER NAME goRegistratura MEMO ELSE SCATTER NAME goRegistratura MEMO BLANK ENDIF ELSE DO tlog WITH 'ESEC: cursorul cRegistratura NU exista' ENDIF * 2) instantierea containerului listei pe un form ascuns DO tlog WITH '--- Test 2: instantiere ct_registratura pe form ascuns' LOCAL loForm loForm = CREATEOBJECT('Form') loForm.Visible = .F. loForm.Width = 810 loForm.Height = 420 loForm.AddObject('ct1', 'ct_registratura') IF VARTYPE(loForm.ct1) = 'O' DO tlog WITH 'OK ct_registratura instantiat; grid RecordSource=' + ; loForm.ct1.grid_registratura.RecordSource + ; ' coloane=' + TRANSFORM(loForm.ct1.grid_registratura.ColumnCount) + ; ' font=' + loForm.ct1.grid_registratura.FontName + ; ' size=' + TRANSFORM(loForm.ct1.grid_registratura.FontSize) DO tlog WITH 'Coloana1: font=' + loForm.ct1.grid_registratura.Columns(1).FontName + ; ' ' + TRANSFORM(loForm.ct1.grid_registratura.Columns(1).FontSize) + ; ' | header=' + loForm.ct1.grid_registratura.Columns(1).Header1.FontName + ; ' ' + TRANSFORM(loForm.ct1.grid_registratura.Columns(1).Header1.FontSize) + ; ' | text1=' + loForm.ct1.grid_registratura.Columns(1).Text1.FontName + ; ' ' + TRANSFORM(loForm.ct1.grid_registratura.Columns(1).Text1.FontSize) loForm.ct1.Visible = .T. DO tlog WITH 'nireg (contor afisat)=' + TRANSFORM(loForm.ct1.nireg) ELSE DO tlog WITH 'ESEC: ct_registratura NU s-a instantiat' ENDIF loForm.Release() * 3) instantierea zonei partener/nr/data (ct_part_nr_data) DO tlog WITH '--- Test 3: instantiere ct_part_nr_data' loForm = CREATEOBJECT('Form') loForm.Visible = .F. loForm.AddObject('ct2', 'ct_part_nr_data') IF VARTYPE(loForm.ct2) = 'O' DO tlog WITH 'OK ct_part_nr_data; llock=' + TRANSFORM(loForm.ct2.llock) + ; ' buton="' + loForm.ct2.Command2.Caption + '"' + ; ' txtClient.ReadOnly=' + TRANSFORM(loForm.ct2.txtClient.ReadOnly) + ; ' font txtClient=' + loForm.ct2.txtClient.FontName + ; ' ' + TRANSFORM(loForm.ct2.txtClient.FontSize) * deblocare/blocare campuri - nu ating baza loForm.ct2.deblocheaza_campuri() DO tlog WITH 'dupa deblocheaza_campuri: txtNumar.ReadOnly=' + TRANSFORM(loForm.ct2.txtNumar.ReadOnly) loForm.ct2.blocheaza_campuri() DO tlog WITH 'dupa blocheaza_campuri: txtNumar.ReadOnly=' + TRANSFORM(loForm.ct2.txtNumar.ReadOnly) ELSE DO tlog WITH 'ESEC: ct_part_nr_data NU s-a instantiat' ENDIF loForm.Release() DO tlog WITH '=== FINAL test_registratura_form' DO tfinal PROCEDURE tlog LPARAMETERS tcMsg STRTOFILE(TRANSFORM(tcMsg) + CHR(13)+CHR(10), gcTestLog, 1) ENDPROC PROCEDURE tfinal ON ERROR CLOSE ALL QUIT ENDPROC