@@ -240,6 +240,7 @@ public void CantUploadReportWithBadScreenElementPlayerCount(bool psp)
240240 [ TestCase ( TokenGame . LittleBigPlanet3 ) ]
241241 [ TestCase ( TokenGame . LittleBigPlanetVita ) ]
242242 [ TestCase ( TokenGame . LittleBigPlanetPSP ) ]
243+ [ TestCase ( TokenGame . BetaBuild ) ]
243244 public void RedirectGriefReportToPhoto ( TokenGame game )
244245 {
245246 using TestContext context = this . GetServer ( ) ;
@@ -271,6 +272,7 @@ public void RedirectGriefReportToPhoto(TokenGame game)
271272 } ,
272273 } ,
273274 LevelId = level . LevelId ,
275+ LevelType = "user" ,
274276 JpegHash = TEST_ASSET_HASH ,
275277 } . AsXML ( ) ) ) . Result ;
276278 Assert . That ( response . StatusCode , Is . EqualTo ( OK ) ) ;
@@ -282,13 +284,19 @@ public void RedirectGriefReportToPhoto(TokenGame game)
282284
283285 GamePhoto photo = photos . Items . First ( ) ;
284286 Assert . That ( photo . Publisher . UserId , Is . EqualTo ( user . UserId ) ) ;
287+
288+ Assert . That ( photo . OriginalLevelId , Is . EqualTo ( level . LevelId ) ) ;
289+ Assert . That ( photo . LevelId , Is . EqualTo ( level . LevelId ) ) ;
290+ Assert . That ( photo . LevelType , Is . EqualTo ( "user" ) ) ;
291+ Assert . That ( photo . OriginalLevelName , Is . EqualTo ( level . Title ) ) ;
285292 }
286293
287294 [ TestCase ( TokenGame . LittleBigPlanet1 ) ]
288295 [ TestCase ( TokenGame . LittleBigPlanet2 ) ]
289296 [ TestCase ( TokenGame . LittleBigPlanet3 ) ]
290297 [ TestCase ( TokenGame . LittleBigPlanetVita ) ]
291298 [ TestCase ( TokenGame . LittleBigPlanetPSP ) ]
299+ [ TestCase ( TokenGame . BetaBuild ) ]
292300 public void RedirectGriefReportToPhotoDeveloperLevel ( TokenGame game )
293301 {
294302 using TestContext context = this . GetServer ( ) ;
@@ -318,7 +326,62 @@ public void RedirectGriefReportToPhotoDeveloperLevel(TokenGame game)
318326 } ,
319327 } ,
320328 } ,
321- LevelId = level . LevelId ,
329+ LevelId = level . StoryId ,
330+ LevelType = "developer" ,
331+ JpegHash = TEST_ASSET_HASH ,
332+ } . AsXML ( ) ) ) . Result ;
333+ Assert . That ( response . StatusCode , Is . EqualTo ( OK ) ) ;
334+
335+ context . Database . Refresh ( ) ;
336+
337+ DatabaseList < GamePhoto > photos = context . Database . GetPhotosByUser ( user , 10 , 0 ) ;
338+ Assert . That ( photos . TotalItems , Is . EqualTo ( 1 ) ) ;
339+
340+ GamePhoto photo = photos . Items . First ( ) ;
341+ Assert . That ( photo . Publisher . UserId , Is . EqualTo ( user . UserId ) ) ;
342+
343+ Assert . That ( photo . OriginalLevelId , Is . EqualTo ( level . StoryId ) ) ;
344+ Assert . That ( photo . LevelId , Is . EqualTo ( level . LevelId ) ) ;
345+ Assert . That ( photo . LevelType , Is . EqualTo ( "developer" ) ) ;
346+ Assert . That ( photo . OriginalLevelName , Is . EqualTo ( level . Title ) ) ;
347+ }
348+
349+ [ TestCase ( TokenGame . LittleBigPlanet1 ) ]
350+ [ TestCase ( TokenGame . LittleBigPlanet2 ) ]
351+ [ TestCase ( TokenGame . LittleBigPlanet3 ) ]
352+ [ TestCase ( TokenGame . LittleBigPlanetVita ) ]
353+ [ TestCase ( TokenGame . LittleBigPlanetPSP ) ]
354+ [ TestCase ( TokenGame . BetaBuild ) ]
355+ public void RedirectGriefReportToPhotoWhenNotUserOrDeveloperSlot ( TokenGame game )
356+ {
357+ using TestContext context = this . GetServer ( ) ;
358+ GameUser user = context . CreateUser ( ) ;
359+ user . RedirectGriefReportsToPhotos = true ;
360+
361+ using HttpClient client = context . GetAuthenticatedClient ( TokenType . Game , game , TokenPlatform . PS3 , user ) ;
362+
363+ //Upload our """photo"""
364+ HttpResponseMessage message = client . PostAsync ( $ "/lbp/upload/{ TEST_ASSET_HASH } ", new ReadOnlyMemoryContent ( TestAsset ) ) . Result ;
365+ Assert . That ( message . StatusCode , Is . EqualTo ( OK ) ) ;
366+
367+ HttpResponseMessage response = client . PostAsync ( "/lbp/grief" , new StringContent ( new GameReport
368+ {
369+ Players = new Player [ ]
370+ {
371+ new ( )
372+ {
373+ Username = user . Username ,
374+ Rectangle = new Rect
375+ {
376+ Top = 10 ,
377+ Left = 10 ,
378+ Bottom = 20 ,
379+ Right = 20 ,
380+ } ,
381+ } ,
382+ } ,
383+ LevelId = 0 ,
384+ LevelType = "pod" ,
322385 JpegHash = TEST_ASSET_HASH ,
323386 } . AsXML ( ) ) ) . Result ;
324387 Assert . That ( response . StatusCode , Is . EqualTo ( OK ) ) ;
@@ -330,6 +393,65 @@ public void RedirectGriefReportToPhotoDeveloperLevel(TokenGame game)
330393
331394 GamePhoto photo = photos . Items . First ( ) ;
332395 Assert . That ( photo . Publisher . UserId , Is . EqualTo ( user . UserId ) ) ;
396+
397+ Assert . That ( photo . OriginalLevelId , Is . EqualTo ( 0 ) ) ;
398+ Assert . That ( photo . LevelId , Is . Null ) ;
399+ Assert . That ( photo . LevelType , Is . EqualTo ( "pod" ) ) ;
400+ Assert . That ( photo . OriginalLevelName , Is . Empty ) ;
401+ }
402+
403+ [ TestCase ( TokenGame . LittleBigPlanet1 ) ]
404+ [ TestCase ( TokenGame . LittleBigPlanet2 ) ]
405+ [ TestCase ( TokenGame . LittleBigPlanet3 ) ]
406+ [ TestCase ( TokenGame . LittleBigPlanetVita ) ]
407+ [ TestCase ( TokenGame . LittleBigPlanetPSP ) ]
408+ [ TestCase ( TokenGame . BetaBuild ) ]
409+ public void RedirectGriefReportToPhotoWhenMissingLevel ( TokenGame game )
410+ {
411+ using TestContext context = this . GetServer ( ) ;
412+ GameUser user = context . CreateUser ( ) ;
413+ user . RedirectGriefReportsToPhotos = true ;
414+
415+ using HttpClient client = context . GetAuthenticatedClient ( TokenType . Game , game , TokenPlatform . PS3 , user ) ;
416+
417+ //Upload our """photo"""
418+ HttpResponseMessage message = client . PostAsync ( $ "/lbp/upload/{ TEST_ASSET_HASH } ", new ReadOnlyMemoryContent ( TestAsset ) ) . Result ;
419+ Assert . That ( message . StatusCode , Is . EqualTo ( OK ) ) ;
420+
421+ HttpResponseMessage response = client . PostAsync ( "/lbp/grief" , new StringContent ( new GameReport
422+ {
423+ Players = new Player [ ]
424+ {
425+ new ( )
426+ {
427+ Username = user . Username ,
428+ Rectangle = new Rect
429+ {
430+ Top = 10 ,
431+ Left = 10 ,
432+ Bottom = 20 ,
433+ Right = 20 ,
434+ } ,
435+ } ,
436+ } ,
437+ LevelId = 1 ,
438+ LevelType = "user" ,
439+ JpegHash = TEST_ASSET_HASH ,
440+ } . AsXML ( ) ) ) . Result ;
441+ Assert . That ( response . StatusCode , Is . EqualTo ( OK ) ) ;
442+
443+ context . Database . Refresh ( ) ;
444+
445+ DatabaseList < GamePhoto > photos = context . Database . GetPhotosByUser ( user , 10 , 0 ) ;
446+ Assert . That ( photos . TotalItems , Is . EqualTo ( 1 ) ) ;
447+
448+ GamePhoto photo = photos . Items . First ( ) ;
449+ Assert . That ( photo . Publisher . UserId , Is . EqualTo ( user . UserId ) ) ;
450+
451+ Assert . That ( photo . OriginalLevelId , Is . EqualTo ( 1 ) ) ;
452+ Assert . That ( photo . LevelId , Is . Null ) ;
453+ Assert . That ( photo . LevelType , Is . EqualTo ( "user" ) ) ;
454+ Assert . That ( photo . OriginalLevelName , Is . Empty ) ;
333455 }
334456
335457 [ Test ]
0 commit comments