Merge pull request #3612 from ByteHamster/fix-feed-date-update
Fix feed date update
This commit is contained in:
commit
85091175a8
@ -185,7 +185,7 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, ImageR
|
||||
if (other.link != null) {
|
||||
link = other.link;
|
||||
}
|
||||
if (other.pubDate != null && other.pubDate.equals(pubDate)) {
|
||||
if (other.pubDate != null && !other.pubDate.equals(pubDate)) {
|
||||
pubDate = other.pubDate;
|
||||
}
|
||||
if (other.media != null) {
|
||||
|
@ -3,6 +3,9 @@ package de.danoeh.antennapod.core.feed;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import static de.danoeh.antennapod.core.feed.FeedItemMother.anyFeedItemWithImage;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
@ -40,6 +43,16 @@ public class FeedItemTest {
|
||||
assertFeedItemImageWasUpdated();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateFromOther_dateChanged() throws Exception {
|
||||
Date originalDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("1952-03-11 00:00:00");
|
||||
Date changedDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("1952-03-11 00:42:42");
|
||||
original.setPubDate(originalDate);
|
||||
changedFeedItem.setPubDate(changedDate);
|
||||
original.updateFromOther(changedFeedItem);
|
||||
assertEquals(changedDate.getTime(), original.getPubDate().getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that a played item loses that state after being marked as new.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user