#include "precompiled_unittests_engine.h" #include "engine/subriptext/SubRipText.h" namespace ITF { using namespace testing; namespace SubRipTextParser { namespace { const char* s_debugData = "1\n00:00:00,840 --> 00:00:03,051\nFlight number 457 from Beijing now arriving.\n\n2\n00:00:05,308 --> 00:00:08,477\nOh, my God.\n\n3\n00:00:10,895 --> 00:00:13,397\nOh, my... Excuse me.Move, move,\nmove!Emergency, please!\n\n4\n00:00:15,607 --> 00:00:18,024\nExcuse me, excuse me.\n\n5\n00:00:20,865 --> 00:00:23,908\n- Rach!\n- Ah!\n\n6\n00:00:25,076 --> 00:00:28,534\nThere you are!\n\n7\n00:00:30,702 --> 00:00:33,620\nHey!\n- Hi!\n\n8\n00:00:35,829 --> 00:00:38,831\nOh!So, so.\n\n9\n00:00:40,999 --> 00:00:43,793\nHow was China ? You!\n\n10\n00:00:45,419 --> 00:00:48,338\nIt was... It was great.\nOh, what happened ?\n\n"; } TEST(SubTitle, test_subtitleParsing) { const char* validFormattedSRT = SubRipTextParser::s_debugData; ITF_VECTOR subtitles; bbool result = parseSRT(validFormattedSRT, subtitles); EXPECT_EQ(btrue, result); subtitles.clear(); /* //Invalid cases to test the error controlling in parser. const char* invalidDataSRT1 = "1\n00:00:00,840 --> 00:00:03,051\nFlight number 457 from Beijing now arriving.\n2\n00:00:05,308 --> 00:00:08,477\nOh, my God.\n"; result = parseSRT(invalidDataSRT1, subtitles); EXPECT_EQ(btrue, result); const char* invalidDataSRT2 = "\nd 23\n4\\vbv \\fcv\\ ds fc s1\n00:00:00,840 --> 00:00:03,051\nFlight number 457 from Beijing now arriving.\n2\n00:00:05,308 --> 00:00:08,477\nOh, my God.\n"; result = parseSRT(invalidDataSRT2, subtitles); EXPECT_EQ(btrue, result);*/ } } }